// File: /workspace/github_c_makefile_star2_O1/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 0x6c55
movq %rsi, %r14
leaq 0x2177(%rip), %rcx      # 0x8c40
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x22ab(%rip), %rdi      # 0x8d84
movl $0x3, %esi
jmp 0x6c8d
leaq 0x22f4(%rip), %rdi      # 0x8dde
jmp 0x6c4e
movq 0x10(%r14), %rdx
leaq 0x22ad(%rip), %rsi      # 0x8da7
jmp 0x6b88
movq 0x10(%r14), %rax
movl (%rax), %eax
cmpl $0x3ff, %eax            # imm = 0x3FF
jg 0x6c63
leal -0x300(%rax), %ecx
cmpl $0x2, %ecx
jb 0x6cb9
cmpl $0x100, %eax            # imm = 0x100
je 0x6cf9
cmpl $0x200, %eax            # imm = 0x200
jne 0x6ce6
leaq 0x22ab(%rip), %rsi      # 0x8de7
leaq 0x164f(%rip), %rdx      # 0x8192
jmp 0x6b88
leaq 0x2277(%rip), %rdi      # 0x8dc3
movl $0xc, %esi
jmp 0x6c8d
movl 0x10(%r14), %edx
cmpl $0xa, %edx
je 0x6c81
cmpl $0x20, %edx
jne 0x6ca1
leaq 0x2219(%rip), %rdi      # 0x8d8c
movl $0x7, %esi
jmp 0x6c8d
movq 0x10(%r14), %rdx
leaq 0x221b(%rip), %rsi      # 0x8da3
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1220
leaq 0x2210(%rip), %rdi      # 0x8db0
jmp 0x6c88
cmpb $0x0, 0x10(%r14)
movl $0x74, %eax
movl $0x66, %edx
cmovnel %eax, %edx
leaq 0x21ca(%rip), %rsi      # 0x8d88
jmp 0x6ca8
movq 0x10(%r14), %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1180
leaq 0x222f(%rip), %rdi      # 0x8e0c
movl $0x5, %esi
jmp 0x6c8d
movl $0x28, %edi
movq %rbx, %rsi
callq 0x11c0
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x6aab
leaq 0x21a5(%rip), %rdi      # 0x8dac
movl $0x3, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1260
movq 0x18(%r14), %rsi
movq %rbx, %rdi
callq 0x6aab
movl $0x29, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x11c0
leaq 0x2190(%rip), %rdi      # 0x8dd0
movl $0xd, %esi
jmp 0x6c8d
leaq 0x216c(%rip), %rdi      # 0x8dba
movl $0x8, %esi
jmp 0x6c8d
leaq 0x21b6(%rip), %rdi      # 0x8e12
movl $0xb, %esi
jmp 0x6c8d
leal -0x401(%rax), %ecx
cmpl $0x2, %ecx
jae 0x6ccc
leaq 0x2172(%rip), %rsi      # 0x8de7
leaq 0x2183(%rip), %rdx      # 0x8dff
jmp 0x6b88
leaq 0x210c(%rip), %rdi      # 0x8d94
movl $0x9, %esi
movl $0x1, %edx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1260
leaq 0x20f6(%rip), %rsi      # 0x8d9e
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1220
leaq 0x2127(%rip), %rsi      # 0x8de7
leaq 0x16c5(%rip), %rdx      # 0x838c
jmp 0x6b88
cmpl $0x400, %eax            # imm = 0x400
jne 0x6ce6
leaq 0x210d(%rip), %rsi      # 0x8de7
leaq 0x2111(%rip), %rdx      # 0x8df2
jmp 0x6b88
leaq 0x20fa(%rip), %rsi      # 0x8de7
leaq 0x16e3(%rip), %rdx      # 0x83d7
jmp 0x6b88
leaq 0x20e7(%rip), %rsi      # 0x8de7
leaq 0x16b8(%rip), %rdx      # 0x83bf
jmp 0x6b88