// File: /workspace/github_cpp_makefile_star2_O3/t0mm4rx[P]piscine_cpp/day01/ex07/main.cpp
// Function: main
int main(int argc, char **argv)
{
	if (argc != 4)
	{
		std::cout << "Error ! Usage: ./replace <file> <find> <replace>" << std::endl;
		return (2);
	}
	if (!strlen(argv[2]) || !strlen(argv[3]))
	{
		std::cout << "Error: strings shouldn't be empty" << std::endl;
		return (2);
	}
	return (find_and_replace(argv[1], std::string(argv[1]) + std::string(".replace"), argv[2], argv[3]));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xd0, %rsp
cmpl $0x4, %edi
jne 0x267c
movq %rsi, %rbx
movq 0x10(%rsi), %rax
cmpb $0x0, (%rax)
je 0x2691
movq 0x18(%rbx), %rax
cmpb $0x0, (%rax)
je 0x2691
movq 0x8(%rbx), %rsi
leaq 0xb0(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2910
movq 0x8(%rbx), %rsi
leaq 0x50(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x2910
leaq 0x40(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xa82(%rip), %rsi       # 0x309e
leaq 0xa83(%rip), %rdx       # 0x30a6
leaq 0x30(%rsp), %rdi
callq 0x294e
leaq 0x60(%rsp), %r15
movq -0x10(%r15), %rcx
movq -0x8(%r15), %r8
movq 0x38(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
cmpq %r15, %rcx
je 0x2652
movq 0x60(%rsp), %rdi
movq 0x30(%rsp), %rsi
cmpq %rdi, %rax
jbe 0x2670
movl $0xf, %edi
cmpq %r14, %rsi
je 0x266b
movq 0x40(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x26e7
leaq 0x50(%rsp), %rdi
callq 0x2060
jmp 0x26f5
movq 0x2955(%rip), %rbx      # 0x4fd8
leaq 0x9c1(%rip), %rsi       # 0x304b
movl $0x30, %edx
jmp 0x26a4
movq 0x2940(%rip), %rbx      # 0x4fd8
leaq 0x9dd(%rip), %rsi       # 0x307c
movl $0x21, %edx
movq %rbx, %rdi
callq 0x2110
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2090
movl $0x2, %ebx
movl %ebx, %eax
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2100
leaq 0x20(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x2719
movq %rsi, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0x271f
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x18(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq 0x10(%rbx), %rsi
leaq 0x90(%rsp), %rdi
leaq 0xd(%rsp), %rdx
callq 0x2910
movq 0x18(%rbx), %rsi
leaq 0x70(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x2910
leaq 0xb0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x90(%rsp), %rdx
leaq 0x70(%rsp), %rcx
callq 0x22dc
movl %eax, %ebx
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x27a7
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x20f0
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x27c8
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x20f0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x27e3
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x20f0
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x27fa
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x20f0
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x2811
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x20f0
leaq 0xc0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26d8
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x20f0
jmp 0x26d8
movq %rax, %rbx
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2864
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x20f0
jmp 0x2864
movq %rax, %rbx
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x288a
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x20f0
jmp 0x288a
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28aa
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x20f0
jmp 0x28aa
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x28c6
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x20f0
jmp 0x28c6
movq %rax, %rbx
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28e6
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x20f0
jmp 0x28e6
movq %rax, %rbx
leaq 0xc0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2907
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x20f0
movq %rbx, %rdi
callq 0x2170
nop