// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/Frames.cpp
// Function: RayTracer::Frames::next()
void Frames::next() {
    // Do nothing if we're already at the last frame
    if (this->frame_index == this->n_frames) {
        return;
    }

    // Depending on whether we should keep everything in memory, write current image to disk and delete it
    if (this->dynamic_writing) {
        this->current_frame->to_png(this->temp_dir + "/out" + to_string(this->frame_index) + ".png");

        delete this->current_frame;
    }

    // Create a new frame
    this->frame_index++;
    this->current_frame = new Image(this->width, this->height);

    // If we should keep everything in memory, update the frames list
    if (!this->dynamic_writing) {
        this->frames[this->frame_index] = this->current_frame;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x80, %rsp
movl 0x44(%rdi), %eax
cmpq %rax, 0x10(%rdi)
je 0x62e9b
movq %rdi, %rbx
cmpb $0x1, 0x38(%rdi)
jne 0x62e67
movq (%rbx), %r14
leaq 0x50(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x48976
leaq 0x26513(%rip), %rsi     # 0x89171
movq %r15, %rdi
callq 0x3a800
movq 0x10(%rbx), %r15
movl $0x1, %esi
cmpq $0xa, %r15
jb 0x62cc4
movl $0x4, %esi
movabsq $0x346dc5d63886594b, %rdi # imm = 0x346DC5D63886594B
movq %r15, %rcx
cmpq $0x63, %rcx
jbe 0x62cbd
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x62cc2
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x62cc4
movq %rcx, %rax
mulq %rdi
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x62c87
addl $-0x3, %esi
jmp 0x62cc4
addl $-0x2, %esi
jmp 0x62cc4
decl %esi
movl %esi, %esi
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rsp, %rdi
xorl %edx, %edx
callq 0x3a510
movq (%rsp), %rdi
movl 0x8(%rsp), %esi
movq %r15, %rdx
callq 0x5d707
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %r8
movq 0x8(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r12, %rcx
je 0x62d0b
movq 0x50(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x62d25
movl $0xf, %esi
cmpq %r13, (%rsp)
je 0x62d20
movq 0x10(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x62d35
movq (%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x3a130
jmp 0x62d41
movq %rsp, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3a4d0
leaq 0x30(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x62d65
movq %rsi, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x62d6b
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x26398(%rip), %rsi     # 0x89127
leaq 0x20(%rsp), %rdi
callq 0x3a800
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x62dc0
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0x62dc7
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x60(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
callq 0x645ce
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x62e02
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3a470
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x62e1d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3a470
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x62e33
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3a470
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x62e4a
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3a470
movq (%rbx), %r14
testq %r14, %r14
je 0x62e67
movq %r14, %rdi
callq 0x63f0c
movl $0x10, %esi
movq %r14, %rdi
callq 0x3a470
incq 0x10(%rbx)
movl $0x10, %edi
callq 0x3a460
movq %rax, %r14
movl 0x3c(%rbx), %esi
movl 0x40(%rbx), %edx
movq %rax, %rdi
callq 0x63e38
movq %r14, (%rbx)
cmpb $0x0, 0x38(%rbx)
jne 0x62e9b
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
movq %r14, (%rax,%rcx,8)
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x62ecb
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3a470
jmp 0x62ecb
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x62eeb
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3a470
jmp 0x62eeb
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x62f08
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3a470
jmp 0x62f08
jmp 0x62f05
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x62f2c
movq 0x50(%rsp), %rsi
incq %rsi
jmp 0x62f27
movq %rax, %rbx
movl $0x10, %esi
movq %r14, %rdi
callq 0x3a470
movq %rbx, %rdi
callq 0x3a780