// File: /workspace/github_c_makefile_star2_O2/theandrew168[P]squeaky/src/value.c
// Function: value_print
void
value_print(FILE* fp, const struct value* value)
{
    switch (value->type) {
        case VALUE_EMPTY_LIST:
            fprintf(fp, "'()");
            break;
        case VALUE_BOOLEAN:
            fprintf(fp, "#%c", value->as.boolean ? 't' : 'f');
            break;
        case VALUE_CHARACTER:
            // TODO: how to support UTF-8 here?
            if (value->as.character == ' ') {
                fprintf(fp, "#\\space");
            } else if (value->as.character == '\n') {
                fprintf(fp, "#\\newline");
            } else {
                fprintf(fp, "#\\%c", value->as.character);
            }
            break;
        case VALUE_NUMBER:
            fprintf(fp, "%ld", value->as.number);
            break;
        case VALUE_STRING:
            // TODO: handle escapes
            fprintf(fp, "\"%s\"", value->as.string);
            break;
        case VALUE_SYMBOL:
            fprintf(fp, "%s", value->as.symbol);
            break;
        case VALUE_PAIR: {
            fprintf(fp, "(");
            value_print(fp, value->as.pair.car);
            fprintf(fp, " . ");
            value_print(fp, value->as.pair.cdr);
            fprintf(fp, ")");
            break;
        }
        case VALUE_BUILTIN:
            fprintf(fp, "<builtin>");
            break;
        case VALUE_LAMBDA:
            fprintf(fp, "<lambda>");
            break;
        case VALUE_INPUT_PORT:
            fprintf(fp, "<input port>");
            break;
        case VALUE_OUTPUT_PORT:
            fprintf(fp, "<output port>");
            break;
        case VALUE_WINDOW:
            fprintf(fp, "<window>");
            break;
        case VALUE_EVENT: {
            switch (value->as.event->type) {
                case SDL_KEYDOWN:
                case SDL_KEYUP:
                    fprintf(fp, "<event:%s>", "keyboard");
                    break;
                case SDL_MOUSEMOTION:
                    fprintf(fp, "<event:%s>", "mouse-motion");
                    break;
                case SDL_MOUSEBUTTONDOWN:
                case SDL_MOUSEBUTTONUP:
                    fprintf(fp, "<event:%s>", "mouse-button");
                    break;
                case SDL_QUIT:
                    fprintf(fp, "<event:%s>", "quit");
                    break;
                case SDL_WINDOWEVENT:
                    fprintf(fp, "<event:%s>", "window");
                    break;
                default:
                    fprintf(fp, "<event:%s>", "undefined");
            }
            break;
        }
        case VALUE_EOF:
            fprintf(fp, "<EOF>");
            break;
        default:
            fprintf(fp, "<undefined>");
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl (%rsi), %eax
decl %eax
cmpl $0xd, %eax
ja 0x6378
movq %rsi, %r14
leaq 0x1a39(%rip), %rcx      # 0x7c40
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x1b6d(%rip), %rdi      # 0x7d84
pushq $0x3
jmp 0x638c
leaq 0x1bb9(%rip), %rdi      # 0x7dde
jmp 0x6374
movq 0x10(%r14), %rdx
leaq 0x1b72(%rip), %rsi      # 0x7da7
jmp 0x63e9
movq 0x10(%r14), %rax
movl (%rax), %eax
leal -0x300(%rax), %ecx
cmpl $0x2, %ecx
jb 0x63c0
leal -0x401(%rax), %ecx
leaq 0x1b8b(%rip), %rsi      # 0x7de7
cmpl $0x2, %ecx
jb 0x63b7
cmpl $0x100, %eax            # imm = 0x100
je 0x63d9
cmpl $0x200, %eax            # imm = 0x200
je 0x63d0
cmpl $0x400, %eax            # imm = 0x400
jne 0x63e2
leaq 0x1b65(%rip), %rdx      # 0x7df2
jmp 0x63e9
leaq 0x1b2a(%rip), %rdi      # 0x7dc3
pushq $0xc
jmp 0x638c
movl 0x10(%r14), %edx
cmpl $0xa, %edx
je 0x6383
cmpl $0x20, %edx
jne 0x639f
leaq 0x1acf(%rip), %rdi      # 0x7d8c
pushq $0x7
jmp 0x638c
movq 0x10(%r14), %rdx
leaq 0x1ad4(%rip), %rsi      # 0x7da3
jmp 0x63e9
leaq 0x1ad5(%rip), %rdi      # 0x7db0
jmp 0x638a
cmpb $0x0, 0x10(%r14)
pushq $0x74
popq %rax
pushq $0x66
popq %rdx
cmovnel %eax, %edx
leaq 0x1a93(%rip), %rsi      # 0x7d88
jmp 0x63a6
movq 0x10(%r14), %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1180
leaq 0x1af8(%rip), %rdi      # 0x7e0c
pushq $0x5
jmp 0x638c
pushq $0x28
popq %rdi
movq %rbx, %rsi
callq 0x11c0
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x61e9
leaq 0x1a76(%rip), %rdi      # 0x7dac
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1260
movq 0x18(%r14), %rsi
movq %rbx, %rdi
callq 0x61e9
pushq $0x29
popq %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x11c0
leaq 0x1a67(%rip), %rdi      # 0x7dd0
pushq $0xd
jmp 0x638c
leaq 0x1a46(%rip), %rdi      # 0x7dba
pushq $0x8
jmp 0x638c
leaq 0x1a93(%rip), %rdi      # 0x7e12
pushq $0xb
jmp 0x638c
leaq 0x1a0a(%rip), %rdi      # 0x7d94
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1260
leaq 0x19f8(%rip), %rsi      # 0x7d9e
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1220
leaq 0x1a41(%rip), %rdx      # 0x7dff
jmp 0x63e9
leaq 0x1a20(%rip), %rsi      # 0x7de7
leaq 0xfbe(%rip), %rdx       # 0x738c
jmp 0x63e9
leaq 0xdbb(%rip), %rdx       # 0x7192
jmp 0x63e9
leaq 0xfdf(%rip), %rdx       # 0x73bf
jmp 0x63e9
leaq 0xfee(%rip), %rdx       # 0x73d7
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1220