In: Computer Science
create a program that outputs a picture that represents halloween in ascii art (jack-o-lantern, witch's hat, etc)
ASSEMBLY LANGUAGE PROGRAM
ANSWER
// JAVA PROGRAM
class M{
static String c(int n){
char a = n == 31
? 94
: n > 31
? 'o'
: 32,
b = n < 31
? '^'
: 32;
return (" _____I_____
\n~~~~~~|\n~|"+a+"|"+b+"|"+a+"|"+b+"~|\n~~|"
+(n > 31
? 94
:a)
+"|"+b+"~~|\n~"
+(n < 31
? "~|VvVvV|"
: n == 31
? "|VvVvV~|"
: "|XXXXX~|")
+" |\n|_|_|_|_|_|_|")
.replace("~", "| ");
}
public static void main(String[] a){
System.out.println(c(12));
System.out.println();
System.out.println(c(31));
System.out.println();
System.out.println(c(100));
}
}
ASSEMBLY LANGUAGE OF THIS PROGRAM :
   .section __TEXT, __text, regular,
pure_instructions
   .macosx_version_min 10, 12
   .globl _main
   .align 4, 0x90
_main:          
           
        ## @main
   .cfi_startproc
## BB#0:
   pushq %rbp
Ltmp0:
   .cfi_def_cfa_offset 16
Ltmp1:
   .cfi_offset %rbp, -16
   movq %rsp, %rbp
Ltmp2:
   .cfi_def_cfa_register %rbp
   subq $16, %rsp
   leaq L_.str(%rip), %rdi
   leaq _s(%rip), %rsi
   movl $2000, -4(%rbp)       ##
imm = 0x7D0
   movl $17, -8(%rbp)
   movl -4(%rbp), %eax
   addl -8(%rbp), %eax
   movl %eax, %edx
   movb $0, %al
   callq _printf
   xorl %edx, %edx
   movl %eax, -12(%rbp)       ##
4-byte Spill
   movl %edx, %eax
   addq $16, %rsp
   popq %rbp
   retq
   .cfi_endproc
   .section __DATA, __data
   .globl _s      
            ##
@s
_s:
   .asciz
   .section __TEXT, __cstring,
cstring_literals
L_.str:          
           
        ## @.str
   .asciz "%s %d \n"
.subsections_via_symbols
OUTPUT OF PROGRAM IS ABOVE IN SNAPSHOT :