// File: /workspace/github_c_makefile_star2_O3/minoki[P]icfpc2006/run_directthreaded_tailcall.c
// Function: main
int main(int argc, char *argv[])
{
    if (argc <= 1) {
        fprintf(stderr, "Usage: %s file.um\n", argv[0]);
        return 1;
    }
    void *rawprogram = NULL;
    size_t rawprogsize = 0;
    {
        FILE *f = fopen(argv[1], "rb");
        assert(f != NULL);
        int seekresult = fseek(f, 0, SEEK_END);
        assert(seekresult == 0);
        long size = ftell(f);
        assert(size >= 0);
        rawprogsize = size;
        seekresult = fseek(f, 0, SEEK_SET);
        assert(seekresult == 0);
        rawprogram = malloc(rawprogsize);
        assert(rawprogram != NULL);
        size_t result = fread(rawprogram, 1, rawprogsize, f);
        assert(result == rawprogsize);
        fclose(f);
    }
    assert(rawprogsize % 4 == 0);
    struct array *prog = malloc(sizeof(uint32_t) + rawprogsize);
    assert(prog != NULL);
    prog->length = rawprogsize / 4;
    {
        uint8_t *rawprogram_ = (uint8_t *)rawprogram;
        for (size_t i = 0; i < rawprogsize / 4; ++i) {
            uint32_t a = (uint32_t)rawprogram_[4 * i];
            uint32_t b = (uint32_t)rawprogram_[4 * i + 1];
            uint32_t c = (uint32_t)rawprogram_[4 * i + 2];
            uint32_t d = (uint32_t)rawprogram_[4 * i + 3];
            prog->data[i] = (a << 24) | (b << 16) | (c << 8) | d;
        }
        free(rawprogram);
    }
    fprintf(stderr, "Loaded program. size=%zu bytes\n", rawprogsize);
    arr = calloc(1, sizeof(struct array *));
    arr[0] = prog;
    recalc();
    program[0](0, arr[0]);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl $0x1, %edi
jg 0x1bc1
movq %rsi, %rdi
callq 0x12c8
movl $0x1, %eax
jmp 0x1c83
movq 0x8(%rsi), %rdi
leaq 0x69b(%rip), %rsi       # 0x2267
callq 0x1130
testq %rax, %rax
je 0x1c89
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x1110
testl %eax, %eax
jne 0x1ca8
movq %rbx, %rdi
callq 0x10d0
testq %rax, %rax
js 0x1cc7
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1110
testl %eax, %eax
jne 0x1ce6
movq %r14, %rdi
callq 0x10f0
testq %rax, %rax
je 0x1d05
movq %rax, %r15
movl $0x1, %esi
movq %rax, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x1060
cmpq %r14, %rax
jne 0x1d24
movq %rbx, %rdi
callq 0x1070
testb $0x3, %r14b
jne 0x1d43
movq %r14, %rdi
addq $0x4, %rdi
callq 0x10f0
testq %rax, %rax
je 0x1d62
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x1241
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x5da(%rip), %rdi       # 0x226a
leaq 0x379(%rip), %rsi       # 0x2010
leaq 0x5d6(%rip), %rcx       # 0x2274
movl $0x11c, %edx            # imm = 0x11C
callq 0x1080
leaq 0x5dc(%rip), %rdi       # 0x228b
leaq 0x35a(%rip), %rsi       # 0x2010
leaq 0x5b7(%rip), %rcx       # 0x2274
movl $0x11e, %edx            # imm = 0x11E
callq 0x1080
leaq 0x5cd(%rip), %rdi       # 0x229b
leaq 0x33b(%rip), %rsi       # 0x2010
leaq 0x598(%rip), %rcx       # 0x2274
movl $0x120, %edx            # imm = 0x120
callq 0x1080
leaq 0x59e(%rip), %rdi       # 0x228b
leaq 0x31c(%rip), %rsi       # 0x2010
leaq 0x579(%rip), %rcx       # 0x2274
movl $0x123, %edx            # imm = 0x123
callq 0x1080
leaq 0x599(%rip), %rdi       # 0x22a5
leaq 0x2fd(%rip), %rsi       # 0x2010
leaq 0x55a(%rip), %rcx       # 0x2274
movl $0x125, %edx            # imm = 0x125
callq 0x1080
leaq 0x58d(%rip), %rdi       # 0x22b8
leaq 0x2de(%rip), %rsi       # 0x2010
leaq 0x53b(%rip), %rcx       # 0x2274
movl $0x127, %edx            # imm = 0x127
callq 0x1080
leaq 0x584(%rip), %rdi       # 0x22ce
leaq 0x2bf(%rip), %rsi       # 0x2010
leaq 0x51c(%rip), %rcx       # 0x2274
movl $0x12a, %edx            # imm = 0x12A
callq 0x1080
leaq 0x57a(%rip), %rdi       # 0x22e3
leaq 0x2a0(%rip), %rsi       # 0x2010
leaq 0x4fd(%rip), %rcx       # 0x2274
movl $0x12c, %edx            # imm = 0x12C
callq 0x1080