// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/Frames.cpp
// Function: RayTracer::Frames::to_mp4(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Frames::to_mp4(string path) {
    // If we haven't, write all images to file
    if (!this->dynamic_writing) {
        for (std::size_t i = 0; i <= this->frame_index; i++) {
            this->frames[i]->to_png(this->temp_dir + "/out" + to_string(i) + ".png");
        }
    }

    // Release ffmpeg on the files
    string command = "ffmpeg ";
    command += "-r " + to_string(this->fps);
    command += " -f image2";
    command += " -s " + to_string(this->width) + "x" + to_string(this->height);
    command += " -i \"" + this->temp_dir + "/out%d.png\"";
    command += " -vcodec libx264";
    command += " -crf 25";
    command += " -pix_fmt yuv420p";
    command += " \"" + path + "\"";

    cout << "Running ffmpeg with command: '" + command + "'" << endl;

    int res = system(command.c_str());
    if (res != 0) {
        cerr << "WARNING: ffmpeg run failed." << endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, 0x68(%rsp)
cmpb $0x0, 0x38(%rdi)
movq %rdi, 0x60(%rsp)
je 0x72d0d
leaq 0x1d852(%rip), %rsi     # 0x902f6
leaq 0x40(%rsp), %rdi
movq %rsp, %rdx
callq 0x56548
movq 0x60(%rsp), %rbx
movl 0x48(%rbx), %esi
leaq 0x20(%rsp), %rdi
callq 0x72430
leaq 0x1d7d4(%rip), %rsi     # 0x9029e
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x6e761
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x52860
movq %rsp, %rdi
callq 0x52888
leaq 0x20(%rsp), %rdi
callq 0x52888
leaq 0x1d801(%rip), %rsi     # 0x902fe
leaq 0x40(%rsp), %rdi
callq 0x52810
movl 0x3c(%rbx), %esi
leaq 0x98(%rsp), %rdi
callq 0x72430
leaq 0x1d7eb(%rip), %rsi     # 0x90309
leaq 0xb8(%rsp), %rdi
leaq 0x98(%rsp), %rdx
callq 0x6e761
leaq 0x195bb(%rip), %rdx     # 0x8c0f5
leaq 0x20(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x5a4df
movl 0x40(%rbx), %esi
leaq 0x78(%rsp), %rdi
callq 0x72430
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x6aac0
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x52860
movq %rsp, %rdi
callq 0x52888
leaq 0x78(%rsp), %rdi
callq 0x52888
leaq 0x20(%rsp), %rdi
callq 0x52888
leaq 0xb8(%rsp), %rdi
callq 0x52888
leaq 0x98(%rsp), %rdi
callq 0x52888
addq $0x18, %rbx
leaq 0x1d755(%rip), %rsi     # 0x9030e
leaq 0x20(%rsp), %rdi
movq %rbx, %rdx
callq 0x59955
leaq 0x1d747(%rip), %rdx     # 0x90314
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x5a4df
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x52860
movq %rsp, %rdi
callq 0x52888
leaq 0x20(%rsp), %rdi
callq 0x52888
leaq 0x1d720(%rip), %rsi     # 0x90320
leaq 0x40(%rsp), %rdi
callq 0x52810
leaq 0x1d720(%rip), %rsi     # 0x90331
leaq 0x40(%rsp), %rdi
callq 0x52810
leaq 0x1d718(%rip), %rsi     # 0x9033a
leaq 0x40(%rsp), %rdi
callq 0x52810
leaq 0x1929b(%rip), %rsi     # 0x8bece
leaq 0x20(%rsp), %rdi
movq 0x68(%rsp), %rdx
callq 0x59955
leaq 0x19286(%rip), %rdx     # 0x8becf
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x5a4df
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x52860
movq %rsp, %rdi
callq 0x52888
leaq 0x20(%rsp), %rdi
callq 0x52888
leaq 0x1d6d0(%rip), %rsi     # 0x9034c
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x59955
leaq 0x1bdfc(%rip), %rdx     # 0x8ea8e
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x5a4df
movq 0x3f2e2(%rip), %rdi     # 0xb1f88
movq %rsp, %rsi
callq 0x52400
movq %rax, %rdi
callq 0x52210
movq %rsp, %rdi
callq 0x52888
leaq 0x20(%rsp), %rdi
callq 0x52888
movq 0x40(%rsp), %rdi
callq 0x523d0
testl %eax, %eax
je 0x72cf1
movq 0x3f303(%rip), %rdi     # 0xb1fe0
leaq 0x1d687(%rip), %rsi     # 0x9036b
callq 0x52450
movq %rax, %rdi
callq 0x52210
leaq 0x40(%rsp), %rdi
callq 0x52888
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18(%rdi), %rax
movq %rax, 0x70(%rsp)
xorl %r12d, %r12d
movq %rsp, %rbp
leaq 0x20(%rsp), %rbx
leaq 0x40(%rsp), %r13
leaq 0xd8(%rsp), %r14
movq 0x60(%rsp), %rax
cmpq 0x10(%rax), %r12
ja 0x72a9d
movq 0x8(%rax), %rax
movq (%rax,%r12,8), %r15
movq %rbp, %rdi
movq 0x70(%rsp), %rsi
leaq 0x1d59d(%rip), %rdx     # 0x902f1
callq 0x72e8d
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6eaa7
movq %r13, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x6aac0
movq %r14, %rdi
movq %r13, %rsi
leaq 0x1d528(%rip), %rdx     # 0x902a7
callq 0x5a4df
movq %r15, %rdi
movq %r14, %rsi
callq 0x735c4
movq %r14, %rdi
callq 0x52888
movq %r13, %rdi
callq 0x52888
movq %rbx, %rdi
callq 0x52888
movq %rbp, %rdi
callq 0x52888
incq %r12
jmp 0x72d2e
jmp 0x72e15
jmp 0x72e3a
jmp 0x72e21
jmp 0x72e15
jmp 0x72e3a
jmp 0x72e21
jmp 0x72e15
jmp 0x72e3a
movq %rax, %rbx
movq %rsp, %rdi
callq 0x52888
jmp 0x72dd7
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x52888
jmp 0x72de6
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x52888
jmp 0x72df5
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x52888
jmp 0x72e07
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
jmp 0x72e31
jmp 0x72e3a
jmp 0x72e21
movq %rax, %rbx
jmp 0x72e2c
jmp 0x72e3a
movq %rax, %rbx
jmp 0x72e7f
movq %rax, %rbx
movq %rsp, %rdi
callq 0x52888
leaq 0x20(%rsp), %rdi
callq 0x52888
jmp 0x72e3d
jmp 0x72e3a
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0x72e7a
movq %rax, %rbx
jmp 0x72e77
movq %rax, %rbx
jmp 0x72e6d
movq %rax, %rbx
jmp 0x72e63
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x52888
leaq 0x40(%rsp), %rdi
callq 0x52888
leaq 0x20(%rsp), %rdi
callq 0x52888
movq %rsp, %rdi
callq 0x52888
movq %rbx, %rdi
callq 0x527a0
nop