// File: /workspace/github_c_makefile_star2_O0/alexj136[P]minijit/src/interpreter.c
// Function: interpret_Comm
InterpretResult *interpret_Comm(Prog *prog, Comm *comm, int *store) {
    if(Comm_isWhile(comm)) {

        InterpretResult *guard_res =
                interpret_Expr(prog, While_guard(comm), store);

        if((guard_res->type != iSuccess) || (guard_res->result < 1)) {
            return guard_res;
        }

        while(true) {

            InterpretResult *comm_res =
                    interpret_Comm(prog, While_body(comm), store);

            if((comm_res->type != iSuccess) ||(comm_res->returning == true)) {
                free(guard_res);
                return comm_res;
            }

            free(guard_res);
            guard_res = interpret_Expr(prog, While_guard(comm), store);

            if(guard_res->type != iSuccess) {
                free(comm_res);
                return guard_res;
            }
            else if(guard_res->result < 1) {
                free(guard_res);
                return comm_res;
            }

            free(comm_res);
        }
    }
    else if(Comm_isAssign(comm) || Comm_isReturn(comm)) {

        InterpretResult *res = interpret_Expr(prog, Assign_expr(comm), store);

        if(res->type != iSuccess) {
            return res;
        }

        if(Comm_isAssign(comm)) {
            store[Assign_name(comm)] = res->result;
        }
        else /* if(Comm_isReturn(comm)) */ {
            res->returning = true;
        }

        return res;
    }
    else if(Comm_isComp(comm)) {

        InterpretResult *res = interpret_Comm(prog, Comp_fst(comm), store);

        if((res->type != iSuccess) || res->returning) {
            return res;
        }

        free(res);

        return interpret_Comm(prog, Comp_snd(comm), store);
    }
    else {
        ERROR("Comm type not recognised.");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1fa0, %rsp           # imm = 0x1FA0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x19ad2
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x19500
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x19a10
movq -0x28(%rbp), %rax
cmpl $0x1, 0x4(%rax)
jge 0x19a1d
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x19c7e
jmp 0x19a1f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x199c0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x19a4b
movq -0x30(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x19a61
movq -0x28(%rbp), %rdi
callq 0x6030
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x19c7e
movq -0x28(%rbp), %rdi
callq 0x6030
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x19500
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x19aa2
movq -0x30(%rbp), %rdi
callq 0x6030
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x19c7e
movq -0x28(%rbp), %rax
cmpl $0x1, 0x4(%rax)
jge 0x19ac2
movq -0x28(%rbp), %rdi
callq 0x6030
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x19c7e
jmp 0x19ac4
movq -0x30(%rbp), %rdi
callq 0x6030
jmp 0x19a1f
movq -0x18(%rbp), %rax
cmpl $0x1, (%rax)
je 0x19ae4
movq -0x18(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x19b4c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x19500
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x0, (%rax)
je 0x19b13
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x19c7e
movq -0x18(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x19b34
movq -0x38(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq 0x20(%rcx), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x19b3f
movq -0x38(%rbp), %rax
movl $0x1, 0x8(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x19c7e
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x19bb5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x199c0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x19b81
movq -0x40(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x19b8e
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x19c7e
movq -0x40(%rbp), %rdi
callq 0x6030
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x199c0
movq %rax, -0x8(%rbp)
jmp 0x19c7e
jmp 0x19bb7
leaq 0xa446(%rip), %rdi      # 0x24004
leaq 0xb89d(%rip), %rsi      # 0x25462
movl $0x91, %edx
leaq 0xb8a3(%rip), %rcx      # 0x25474
movb $0x0, %al
callq 0x60f0
leaq 0xa44d(%rip), %rdi      # 0x2402c
leaq 0xa721(%rip), %rsi      # 0x24307
movb $0x0, %al
callq 0x60f0
leaq -0x1f80(%rbp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x60d0
movl %eax, -0x1f84(%rbp)
leaq -0x1f80(%rbp), %rdi
movl -0x1f84(%rbp), %esi
callq 0x60a0
movq %rax, -0x1f90(%rbp)
leaq 0xa427(%rip), %rdi      # 0x2404b
movb $0x0, %al
callq 0x60f0
movl $0x0, -0x1f94(%rbp)
movl -0x1f94(%rbp), %eax
cmpl -0x1f84(%rbp), %eax
jge 0x19c74
movq -0x1f90(%rbp), %rax
movslq -0x1f94(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xa3d0(%rip), %rdi      # 0x2402c
movb $0x0, %al
callq 0x60f0
movl -0x1f94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1f94(%rbp)
jmp 0x19c35
movl $0x1, %edi
callq 0x61a0
movq -0x8(%rbp), %rax
addq $0x1fa0, %rsp           # imm = 0x1FA0
popq %rbp
retq
nopl (%rax,%rax)