// File: /workspace/github_c_makefile_star2_O2/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 0x1ae3
movq 0x252a(%rip), %rax      # 0x3ff0
movq (%rax), %rdi
movq (%rsi), %rdx
leaq 0x781(%rip), %rsi       # 0x2254
xorl %eax, %eax
callq 0x10c0
pushq $0x1
popq %r15
jmp 0x1c06
movq 0x8(%rsi), %rdi
leaq 0x779(%rip), %rsi       # 0x2267
callq 0x1130
testq %rax, %rax
je 0x1c0f
movq %rax, %r14
pushq $0x2
popq %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x1110
testl %eax, %eax
jne 0x1c2e
movq %r14, %rdi
callq 0x10d0
testq %rax, %rax
js 0x1c4d
movq %rax, %rbx
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1110
testl %eax, %eax
jne 0x1c6c
movq %rbx, %rdi
callq 0x10f0
testq %rax, %rax
je 0x1c8b
movq %rax, %r15
pushq $0x1
popq %rsi
movq %rax, %rdi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x1060
cmpq %rbx, %rax
jne 0x1caa
movq %r14, %rdi
callq 0x1070
testb $0x3, %bl
jne 0x1cc9
leaq 0x4(%rbx), %rdi
callq 0x10f0
testq %rax, %rax
je 0x1ce8
movq %rax, %r14
movq %rbx, %rax
shrq $0x2, %rax
movl %eax, (%r14)
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x1bb1
movl (%r15,%rcx,4), %edx
bswapl %edx
movl %edx, 0x4(%r14,%rcx,4)
incq %rcx
jmp 0x1b9c
movq %r15, %rdi
callq 0x1030
movq 0x2430(%rip), %rax      # 0x3ff0
movq (%rax), %rdi
leaq 0x726(%rip), %rsi       # 0x22f0
xorl %r15d, %r15d
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10c0
pushq $0x1
popq %rdi
pushq $0x8
popq %rsi
callq 0x10a0
movq %rax, 0x2537(%rip)      # 0x4120
movq %r14, (%rax)
callq 0x19e0
movq 0x2520(%rip), %rax      # 0x4118
movq 0x2521(%rip), %rcx      # 0x4120
movq (%rcx), %rsi
xorl %edi, %edi
callq *(%rax)
movl %r15d, %eax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x654(%rip), %rdi       # 0x226a
leaq 0x3f3(%rip), %rsi       # 0x2010
leaq 0x650(%rip), %rcx       # 0x2274
movl $0x11c, %edx            # imm = 0x11C
callq 0x1080
leaq 0x656(%rip), %rdi       # 0x228b
leaq 0x3d4(%rip), %rsi       # 0x2010
leaq 0x631(%rip), %rcx       # 0x2274
movl $0x11e, %edx            # imm = 0x11E
callq 0x1080
leaq 0x647(%rip), %rdi       # 0x229b
leaq 0x3b5(%rip), %rsi       # 0x2010
leaq 0x612(%rip), %rcx       # 0x2274
movl $0x120, %edx            # imm = 0x120
callq 0x1080
leaq 0x618(%rip), %rdi       # 0x228b
leaq 0x396(%rip), %rsi       # 0x2010
leaq 0x5f3(%rip), %rcx       # 0x2274
movl $0x123, %edx            # imm = 0x123
callq 0x1080
leaq 0x613(%rip), %rdi       # 0x22a5
leaq 0x377(%rip), %rsi       # 0x2010
leaq 0x5d4(%rip), %rcx       # 0x2274
movl $0x125, %edx            # imm = 0x125
callq 0x1080
leaq 0x607(%rip), %rdi       # 0x22b8
leaq 0x358(%rip), %rsi       # 0x2010
leaq 0x5b5(%rip), %rcx       # 0x2274
movl $0x127, %edx            # imm = 0x127
callq 0x1080
leaq 0x5fe(%rip), %rdi       # 0x22ce
leaq 0x339(%rip), %rsi       # 0x2010
leaq 0x596(%rip), %rcx       # 0x2274
movl $0x12a, %edx            # imm = 0x12A
callq 0x1080
leaq 0x5f4(%rip), %rdi       # 0x22e3
leaq 0x31a(%rip), %rsi       # 0x2010
leaq 0x577(%rip), %rcx       # 0x2274
movl $0x12c, %edx            # imm = 0x12C
callq 0x1080