// File: /workspace/github_c_makefile_star2_O1/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 0x1bd4
movq %rsi, %rdi
callq 0x12c8
movl $0x1, %eax
jmp 0x1c96
movq 0x8(%rsi), %rdi
leaq 0x688(%rip), %rsi       # 0x2267
callq 0x1130
testq %rax, %rax
je 0x1c9c
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x1110
testl %eax, %eax
jne 0x1cbb
movq %rbx, %rdi
callq 0x10d0
testq %rax, %rax
js 0x1cda
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1110
testl %eax, %eax
jne 0x1cf9
movq %r14, %rdi
callq 0x10f0
testq %rax, %rax
je 0x1d18
movq %rax, %r15
movl $0x1, %esi
movq %rax, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x1060
cmpq %r14, %rax
jne 0x1d37
movq %rbx, %rdi
callq 0x1070
testb $0x3, %r14b
jne 0x1d56
movq %r14, %rdi
addq $0x4, %rdi
callq 0x10f0
testq %rax, %rax
je 0x1d75
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x1241
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x5c7(%rip), %rdi       # 0x226a
leaq 0x366(%rip), %rsi       # 0x2010
leaq 0x5c3(%rip), %rcx       # 0x2274
movl $0x11c, %edx            # imm = 0x11C
callq 0x1080
leaq 0x5c9(%rip), %rdi       # 0x228b
leaq 0x347(%rip), %rsi       # 0x2010
leaq 0x5a4(%rip), %rcx       # 0x2274
movl $0x11e, %edx            # imm = 0x11E
callq 0x1080
leaq 0x5ba(%rip), %rdi       # 0x229b
leaq 0x328(%rip), %rsi       # 0x2010
leaq 0x585(%rip), %rcx       # 0x2274
movl $0x120, %edx            # imm = 0x120
callq 0x1080
leaq 0x58b(%rip), %rdi       # 0x228b
leaq 0x309(%rip), %rsi       # 0x2010
leaq 0x566(%rip), %rcx       # 0x2274
movl $0x123, %edx            # imm = 0x123
callq 0x1080
leaq 0x586(%rip), %rdi       # 0x22a5
leaq 0x2ea(%rip), %rsi       # 0x2010
leaq 0x547(%rip), %rcx       # 0x2274
movl $0x125, %edx            # imm = 0x125
callq 0x1080
leaq 0x57a(%rip), %rdi       # 0x22b8
leaq 0x2cb(%rip), %rsi       # 0x2010
leaq 0x528(%rip), %rcx       # 0x2274
movl $0x127, %edx            # imm = 0x127
callq 0x1080
leaq 0x571(%rip), %rdi       # 0x22ce
leaq 0x2ac(%rip), %rsi       # 0x2010
leaq 0x509(%rip), %rcx       # 0x2274
movl $0x12a, %edx            # imm = 0x12A
callq 0x1080
leaq 0x567(%rip), %rdi       # 0x22e3
leaq 0x28d(%rip), %rsi       # 0x2010
leaq 0x4ea(%rip), %rcx       # 0x2274
movl $0x12c, %edx            # imm = 0x12C
callq 0x1080