// File: /workspace/github_c_makefile_star2_O1/alexj136[P]minijit/src/icodegen.c
// Function: icodegen_Comm
ICodeOperationVector *icodegen_Comm(Prog *prog, Comm *comm, int *next_label,
        int *func_labels) {

    BEGIN_CODE_GENERATION;

    if(Comm_isWhile(comm)) {

        // Label names
        int guard_label = (*next_label)++;
        int end_label   = (*next_label)++;

        // Guard label & guard evaluation
        INSERT_OPERATION(LABEL      , guard_label   , 0                 );
        INSERT_EXPR_CODE(While_guard(comm));

        // Jump straight to the end if the guard was less than 1
        INSERT_OPERATION(JUMPCOND   , end_label     , ACCUMULATOR       );

        // If we didn't jump to the end, run the code for the body and jump back
        // to the guard evaluation
        INSERT_COMM_CODE(While_body(comm)                               );
        INSERT_OPERATION(JUMP       , guard_label   , 0                 );

        // End label
        INSERT_OPERATION(LABEL      , end_label     , 0                 );
    }
    else if(Comm_isAssign(comm)) {

        // Evaluate the expression
        INSERT_EXPR_CODE(Assign_expr(comm));

        // Calculate the address to store the value, store the calculated
        // address in temporary
        INSERT_OPERATION(LOADIMM    , -Assign_name(comm), TEMPORARY     );
        INSERT_OPERATION(ADD        , TEMPORARY         , FRAME_POINTER );

        // Store the expression result at the calculated address
        INSERT_OPERATION(STORE      , ACCUMULATOR       , TEMPORARY     );
    }
    else if(Comm_isComp(comm)) {

        // Just insert code for the first and second command
        INSERT_COMM_CODE(Comp_fst(comm));
        INSERT_COMM_CODE(Comp_snd(comm));
    }
    else if(Comm_isReturn(comm)) {

        // Evaluate the expression
        INSERT_EXPR_CODE(Return_expr(comm));

        // Return to caller
        INSERT_OPERATION(JUMPADDR   , RETURN_ADDRESS    , 0             );
    }
    else {
        ERROR("Comm type not recognised.");
    }

    RETURN_GENERATED_CODE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f58, %rsp           # imm = 0x1F58
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r13
xorl %eax, %eax
callq 0x14232
movq %rax, %rbx
movl (%r15), %eax
cmpq $0x3, %rax
ja 0x1552f
leaq 0x73df(%rip), %rcx      # 0x1c714
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl (%r12), %esi
movq %rsi, -0x40(%rbp)
leal 0x1(%rsi), %eax
movl %eax, -0x2c(%rbp)
leal 0x2(%rsi), %eax
movl %eax, (%r12)
movl $0xa, %edi
xorl %edx, %edx
callq 0x13d40
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1431c
movq 0x8(%r15), %rsi
movq %r13, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0x155c7
movq %r14, -0x38(%rbp)
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1440b
movq %r14, %rdi
callq 0x149e4
movl $0x7, %edi
movl -0x2c(%rbp), %esi
movl $0x4, %edx
callq 0x13d40
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1431c
movq 0x10(%r15), %rsi
movq %r13, %rdi
movq %r12, %rdx
movq -0x38(%rbp), %rcx
callq 0x152f7
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1440b
movq %r14, %rdi
callq 0x149e4
movl $0x6, %edi
movq -0x40(%rbp), %rsi
xorl %edx, %edx
callq 0x13d40
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1431c
movl $0xa, %edi
movl -0x2c(%rbp), %esi
jmp 0x15490
movq 0x10(%r15), %rsi
movq %r13, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0x152f7
movq %r14, -0x38(%rbp)
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1440b
movq %r14, %rdi
callq 0x149e4
movq 0x18(%r15), %rsi
movq %r13, %rdi
movq %r12, %rdx
movq -0x38(%rbp), %rcx
callq 0x152f7
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1440b
movq %r14, %rdi
callq 0x149e4
jmp 0x1551a
movq 0x8(%r15), %rsi
movq %r13, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0x155c7
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1440b
movq %r14, %rdi
callq 0x149e4
movl $0x9, %edi
movl $0x2, %esi
xorl %edx, %edx
jmp 0x1550a
movq 0x8(%r15), %rsi
movq %r13, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0x155c7
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1440b
movq %r14, %rdi
callq 0x149e4
xorl %esi, %esi
subl 0x20(%r15), %esi
movl $0x5, %edi
movl $0x5, %edx
callq 0x13d40
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1431c
movl $0x3, %edi
movl $0x5, %esi
movl $0x1, %edx
callq 0x13d40
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1431c
movl $0x2, %edi
movl $0x4, %esi
movl $0x5, %edx
callq 0x13d40
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1431c
movq %rbx, %rax
addq $0x1f58, %rsp           # imm = 0x1F58
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5ace(%rip), %rdi      # 0x1b004
leaq 0x71fb(%rip), %rsi      # 0x1c738
leaq 0x7203(%rip), %rcx      # 0x1c747
movl $0x8c, %edx
xorl %eax, %eax
callq 0x6100
leaq 0x5ad5(%rip), %rdi      # 0x1b02c
leaq 0x5dad(%rip), %rsi      # 0x1b30b
xorl %eax, %eax
callq 0x6100
leaq -0x1f80(%rbp), %rbx
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x60e0
movl %eax, %r14d
movq %rbx, %rdi
movl %eax, %esi
callq 0x60b0
movq %rax, %rbx
leaq 0x5c86(%rip), %rdi      # 0x1b216
callq 0x6070
testl %r14d, %r14d
jle 0x155bd
movl %r14d, %r15d
leaq 0x5a88(%rip), %r14      # 0x1b02c
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x6100
incq %r12
cmpq %r12, %r15
jne 0x155a7
movl $0x1, %edi
callq 0x61a0