// File: /workspace/github_c_makefile_star2_O0/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
subq $0x2000, %rsp           # imm = 0x2000
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movb $0x0, %al
callq 0x1a4f0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x1be15
movq -0x18(%rbp), %rcx
movl (%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, (%rcx)
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rcx
movl (%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, (%rcx)
movl %eax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x1fc0(%rbp)
movl -0x2c(%rbp), %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0x19c90
movq -0x1fc0(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x1c0b0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x1a7a0
movq -0x38(%rbp), %rdi
callq 0x1afa0
movq -0x28(%rbp), %rax
movq %rax, -0x1fc8(%rbp)
movl -0x30(%rbp), %esi
movl $0x7, %edi
movl $0x4, %edx
callq 0x19c90
movq -0x1fc8(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x1bcb0
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x1a7a0
movq -0x40(%rbp), %rdi
callq 0x1afa0
movq -0x28(%rbp), %rax
movq %rax, -0x1fd8(%rbp)
movl -0x2c(%rbp), %esi
movl $0x6, %edi
xorl %edx, %edx
callq 0x19c90
movq -0x1fd8(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
movq -0x28(%rbp), %rax
movq %rax, -0x1fd0(%rbp)
movl -0x30(%rbp), %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0x19c90
movq -0x1fd0(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
jmp 0x1c09c
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x1bee7
jmp 0x1be24
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x1c0b0
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x1a7a0
movq -0x48(%rbp), %rdi
callq 0x1afa0
movq -0x28(%rbp), %rax
movq %rax, -0x1ff0(%rbp)
movq -0x10(%rbp), %rax
xorl %esi, %esi
subl 0x20(%rax), %esi
movl $0x5, %edx
movl %edx, %edi
callq 0x19c90
movq -0x1ff0(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
movq -0x28(%rbp), %rax
movq %rax, -0x1fe8(%rbp)
movl $0x3, %edi
movl $0x5, %esi
movl $0x1, %edx
callq 0x19c90
movq -0x1fe8(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
movq -0x28(%rbp), %rax
movq %rax, -0x1fe0(%rbp)
movl $0x2, %edi
movl $0x4, %esi
movl $0x5, %edx
callq 0x19c90
movq -0x1fe0(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
jmp 0x1c09a
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x1bf5f
jmp 0x1bef2
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x1bcb0
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x1a7a0
movq -0x50(%rbp), %rdi
callq 0x1afa0
jmp 0x1bf27
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x1bcb0
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x1a7a0
movq -0x58(%rbp), %rdi
callq 0x1afa0
jmp 0x1c098
movq -0x10(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x1bfcd
jmp 0x1bf6a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x1c0b0
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x1a7a0
movq -0x60(%rbp), %rdi
callq 0x1afa0
movq -0x28(%rbp), %rax
movq %rax, -0x1ff8(%rbp)
movl $0x9, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x19c90
movq -0x1ff8(%rbp), %rdi
movq %rax, %rsi
callq 0x1a640
jmp 0x1c096
jmp 0x1bfcf
leaq 0x802e(%rip), %rdi      # 0x24004
leaq 0x970e(%rip), %rsi      # 0x256eb
movl $0x8c, %edx
leaq 0x9711(%rip), %rcx      # 0x256fa
movb $0x0, %al
callq 0x60f0
leaq 0x8035(%rip), %rdi      # 0x2402c
leaq 0x8309(%rip), %rsi      # 0x24307
movb $0x0, %al
callq 0x60f0
leaq -0x1fa0(%rbp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x60d0
movl %eax, -0x1fa4(%rbp)
leaq -0x1fa0(%rbp), %rdi
movl -0x1fa4(%rbp), %esi
callq 0x60a0
movq %rax, -0x1fb0(%rbp)
leaq 0x800f(%rip), %rdi      # 0x2404b
movb $0x0, %al
callq 0x60f0
movl $0x0, -0x1fb4(%rbp)
movl -0x1fb4(%rbp), %eax
cmpl -0x1fa4(%rbp), %eax
jge 0x1c08c
movq -0x1fb0(%rbp), %rax
movslq -0x1fb4(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x7fb8(%rip), %rdi      # 0x2402c
movb $0x0, %al
callq 0x60f0
movl -0x1fb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1fb4(%rbp)
jmp 0x1c04d
movl $0x1, %edi
callq 0x61a0
jmp 0x1c098
jmp 0x1c09a
jmp 0x1c09c
movq -0x28(%rbp), %rax
addq $0x2000, %rsp           # imm = 0x2000
popq %rbp
retq
nopl (%rax)