// File: /workspace/github_c_makefile_star2_O2/masyagin1998[P]GCI/src/bytecode-generator/bytecode-generator.c
// Function: additive_expr_ast_bytecode_generate
static enum BYTECODE_GENERATOR_CODES additive_expr_ast_bytecode_generate(bytecode_generator_type_t bc_gen, const struct ADDITIVE_EXPR_AST*ast)
{
    size_t i;

    enum BYTECODE_GENERATOR_CODES r = multiplicative_expr_ast_bytecode_generate(bc_gen, ast->muls[0]);
    if (r != BYTECODE_GENERATOR_OK) {
        return r;
    }
    for (i = 1; i < ast->muls_len; i++) {
        r = multiplicative_expr_ast_bytecode_generate(bc_gen, ast->muls[i]);
        if (r != BYTECODE_GENERATOR_OK) {
            return r;
        }
        if (ast->ops[i - 1] == AST_ADDITIVE_OP_PLUS) {
            PUSH_BACK(bc_gen->bc->op_codes, BC_OP_ADDITIVE_PLUS);
        } else if (ast->ops[i - 1] == AST_ADDITIVE_OP_MINUS) {
            PUSH_BACK(bc_gen->bc->op_codes, BC_OP_ADDITIVE_MINUS);
        } else {
            fprintf(stderr, "Invalid AST_ADDITIVE_OP type: %d\n", ast->ops[i - 1]);
            exit(EXIT_FAILURE);
        }
    }

    return BYTECODE_GENERATOR_OK;    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rax
movq (%rax), %rsi
callq 0xa877
testl %eax, %eax
je 0xa6a0
movl %eax, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %r13
pushq $0x8
popq %r12
xorl %r15d, %r15d
cmpq 0x10(%rbx), %r13
jae 0xa68e
movq (%rbx), %rax
movq (%rax,%r13,8), %rsi
movq %r14, %rdi
callq 0xa877
testl %eax, %eax
jne 0xa68b
movq 0x8(%rbx), %rax
movl -0x4(%rax,%r13,4), %edx
cmpl $0x1, %edx
je 0xa720
testl %edx, %edx
jne 0xa7c3
movq 0x8(%r14), %rbp
movq 0x8(%rbp), %rsi
cmpq 0x10(%rbp), %rsi
jne 0xa765
testq %rsi, %rsi
je 0xa794
leaq (%rsi,%rsi), %rax
movq %rax, 0x10(%rbp)
movq (%rbp), %rdi
shlq $0x4, %rsi
callq 0x1160
movq 0x8(%r14), %rbp
movq %rax, (%rbp)
testq %rax, %rax
je 0xa7e0
movq 0x8(%rbp), %rsi
jmp 0xa7af
movq 0x8(%r14), %rbp
movq 0x8(%rbp), %rsi
cmpq 0x10(%rbp), %rsi
jne 0xa75f
testq %rsi, %rsi
je 0xa76b
leaq (%rsi,%rsi), %rax
movq %rax, 0x10(%rbp)
movq (%rbp), %rdi
shlq $0x4, %rsi
callq 0x1160
movq 0x8(%r14), %rbp
movq %rax, (%rbp)
testq %rax, %rax
je 0xa802
movq 0x8(%rbp), %rsi
jmp 0xa78a
movq (%rbp), %rax
jmp 0xa78a
movq (%rbp), %rax
jmp 0xa7af
movq $0x1, 0x10(%rbp)
movq %r12, %rdi
callq 0x1130
movq %rax, (%rbp)
testq %rax, %rax
je 0xa847
xorl %esi, %esi
movq $0x15, (%rax,%rsi,8)
jmp 0xa7b7
movq $0x1, 0x10(%rbp)
movq %r12, %rdi
callq 0x1130
movq %rax, (%rbp)
testq %rax, %rax
je 0xa824
xorl %esi, %esi
movq $0x14, (%rax,%rsi,8)
incq 0x8(%rbp)
incq %r13
jmp 0xa6ab
movq 0xb826(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x4fdb(%rip), %rsi      # 0xf7af
xorl %eax, %eax
callq 0x1100
jmp 0xa86f
movq 0xb809(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
movq 0x10(%rbp), %r8
shlq $0x3, %r8
leaq 0x40f8(%rip), %rsi      # 0xe8f1
leaq 0x4b18(%rip), %rdx      # 0xf318
jmp 0xa840
movq 0xb7e7(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
movq 0x10(%rbp), %r8
shlq $0x3, %r8
leaq 0x40d6(%rip), %rsi      # 0xe8f1
leaq 0x4af6(%rip), %rdx      # 0xf318
jmp 0xa863
movq 0xb7c5(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x3d89(%rip), %rsi      # 0xe5be
leaq 0x4adc(%rip), %rdx      # 0xf318
pushq $0x8
popq %r8
movl $0x179, %ecx            # imm = 0x179
jmp 0xa868
movq 0xb7a2(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x3d66(%rip), %rsi      # 0xe5be
leaq 0x4ab9(%rip), %rdx      # 0xf318
pushq $0x8
popq %r8
movl $0x17b, %ecx            # imm = 0x17B
xorl %eax, %eax
callq 0x1100
pushq $0x1
popq %rdi
callq 0x1180