// File: /workspace/github_cpp_makefile_star2_O3/kryffin[P]software-rasterizer/rasterizer.cpp
// Function: writeImage(std::vector<int, std::allocator<int>>)
void writeImage (std::vector<int>frameBuffer) {
    std::ofstream file;
    file.open("out.ppm");
    file << "P3" << std::endl << WIDTH << " " << HEIGHT << std::endl << 255 << std::endl;
    int x, y, c;
    for (y = 0; y < HEIGHT; y++) {
        for (x = WIDTH-1; x >= 0; x--) { //reverse course to inverse the rendered image along the x-axis
            for (c = 0; c < 3; c++) {
                file << frameBuffer[((x + (y * WIDTH)) * 3) + c] << " ";
            }
        }
        file << std::endl;
    }
    file.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdi, %rbx
leaq -0x238(%rbp), %r14
movq %r14, %rdi
callq 0x22c0
leaq 0x23b7(%rip), %rsi      # 0x5080
movq %r14, %rdi
movl $0x10, %edx
callq 0x2050
leaq 0x23ab(%rip), %rsi      # 0x5088
movl $0x2, %edx
movq %r14, %rdi
callq 0x21c0
movq -0x238(%rbp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
leaq -0x238(%rbp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq %rax, %rdi
movl $0x320, %esi            # imm = 0x320
callq 0x22d0
movq %rax, %r15
leaq 0x245c(%rip), %rsi      # 0x518c
movl $0x1, %edx
movq %rax, %rdi
callq 0x21c0
movq %r15, %rdi
movl $0x320, %esi            # imm = 0x320
callq 0x22d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq %rax, %rdi
movl $0xff, %esi
callq 0x22d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movl $0x2574, %r12d          # imm = 0x2574
xorl %r14d, %r14d
leaq 0x23d1(%rip), %r15      # 0x518c
movq %r14, -0x38(%rbp)
movl $0x31f, %r13d           # imm = 0x31F
movq %r12, -0x30(%rbp)
xorl %r14d, %r14d
movq (%rbx), %rax
addq %r12, %rax
movl (%rax,%r14,4), %esi
leaq -0x238(%rbp), %rdi
callq 0x22d0
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21c0
incq %r14
cmpq $0x3, %r14
jne 0x2dcc
addq $-0xc, %r12
subq $0x1, %r13
jae 0x2dc9
movq -0x238(%rbp), %rax
movq -0x18(%rax), %rdi
leaq -0x238(%rbp), %rax
addq %rax, %rdi
movl $0xa, %esi
callq 0x2180
movq -0x38(%rbp), %r14
movsbl %al, %esi
leaq -0x238(%rbp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
incq %r14
movq -0x30(%rbp), %r12
addq $0x2580, %r12           # imm = 0x2580
cmpq $0x320, %r14            # imm = 0x320
jne 0x2dbb
leaq -0x238(%rbp), %rdi
callq 0x2230
movq 0x4153(%rip), %rax      # 0x6fc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x230(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x238(%rbp,%rcx)
callq 0x2150
leaq -0x140(%rbp), %rdi
callq 0x2070
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2eb4
jmp 0x2eb4
jmp 0x2eb4
movq %rax, %rbx
movq 0x4102(%rip), %rax      # 0x6fc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x230(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x238(%rbp,%rcx)
callq 0x2150
leaq -0x140(%rbp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x22e0