// File: /workspace/github_cpp_makefile_star2_O3/mniip[P]sandbox/main.cpp
// Function: TracedThread::should_replace_path(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, int, int)
bool should_replace_path(std::string path, std::string &newpath, int at, int flags)
	{
		if(path.compare(0, strlen("http:/"), "http:/") == 0 && path.compare(0, strlen("http://"), "http://") != 0)
			path = "http://" + path.substr(strlen("http:/"));
		else if(path.compare(0, strlen("https:/"), "https:/") == 0 && path.compare(0, strlen("https://"), "https://") != 0)
			path = "https://" + path.substr(strlen("https:/"));
		for(std::vector<std::string>::const_iterator i = conf_http.begin(), end = conf_http.end(); i != end; i++)
			if(path.compare(0, i->size(), *i) == 0)
			{
				if((flags & O_ACCMODE) != O_RDONLY)
				{
					newpath = "/dev/null";
					return true;
				}
				std::string filename = conf_downloadpat;
				int fd = mkstemp(&filename[0]);
				if(fd == -1)
					return false;
				unlink(&filename[0]);

				pid_t pid = fork();
				if(pid == -1)
				{
					close(fd);
					return false;
				}

				if(pid == 0)
				{
					dup2(fd, 1);
					close(fd);
					execlp("curl", "curl", "--silent", "--globoff", "--", path.c_str(), NULL);
					exit(1);
				}

				while(1)
				{
					int status;
					if(waitpid(pid, &status, 0) == -1)
					{
						close(fd);
						return false;
					}
					if(WIFEXITED(status) || WIFSIGNALED(status))
						break;
				}

				pipe_fd = fd;
				std::stringstream ss;
				ss << "/proc/" << getpid() << "/fd/" << pipe_fd;

				newpath = ss.str();
				return true;
			}
		return false;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movl %r8d, %ebp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x4b8e(%rip), %rcx      # 0xe672
movl $0x6, %edx
movq %rsi, %rdi
xorl %esi, %esi
callq 0x4520
testl %eax, %eax
je 0x9b6a
leaq 0x4b83(%rip), %rcx      # 0xe681
movl $0x7, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x4520
testl %eax, %eax
jne 0x9c45
leaq 0x4b6d(%rip), %rcx      # 0xe689
movl $0x8, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x4520
testl %eax, %eax
je 0x9c45
leaq 0x10(%rsp), %r12
movl $0x7, %edx
movq %r12, %rdi
movq %r15, %rsi
movq $-0x1, %rcx
callq 0x4400
leaq 0x4b33(%rip), %rcx      # 0xe689
movl $0x8, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4450
jmp 0x9bbd
leaq 0x4b08(%rip), %rcx      # 0xe679
movl $0x7, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x4520
testl %eax, %eax
je 0x9af7
leaq 0x10(%rsp), %r12
movl $0x6, %edx
movq %r12, %rdi
movq %r15, %rsi
movq $-0x1, %rcx
callq 0x4400
leaq 0x4ace(%rip), %rcx      # 0xe679
movl $0x7, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4450
leaq 0x60(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x9be4
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x9bec
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x50(%rsp), %r12
movq %rdx, 0x8(%r12)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r15, %rdi
movq %r12, %rsi
callq 0x44b0
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x9c2a
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x43e0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9c45
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43e0
leaq 0x9944(%rip), %rax      # 0x13590
movq (%rax), %r12
movq 0x8(%rax), %r13
cmpq %r13, %r12
je 0x9c74
movq 0x8(%r12), %rdx
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rcx
callq 0x4500
testl %eax, %eax
je 0x9c7b
addq $0x20, %r12
jmp 0x9c53
xorl %eax, %eax
jmp 0x9e15
testb $0x3, %bpl
je 0x9ca5
movq 0x8(%rbx), %rdx
leaq 0x4a06(%rip), %rcx      # 0xe692
movl $0x9, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4660
movb $0x1, %al
movb $0x1, %bl
jmp 0x9e15
leaq 0x20(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x98f3(%rip), %rax      # 0x135a8
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x8eda
movq (%r12), %rdi
callq 0x4140
movl %eax, %ebp
cmpl $-0x1, %eax
je 0x9dfa
movq 0x10(%rsp), %rdi
callq 0x41d0
callq 0x40f0
cmpl $-0x1, %eax
je 0x9dea
movl %eax, %r12d
testl %eax, %eax
je 0x9e29
leaq 0x50(%rsp), %r15
movl %r12d, %edi
movq %r15, %rsi
xorl %edx, %edx
callq 0x4320
cmpl $-0x1, %eax
je 0x9df3
movl 0x50(%rsp), %eax
andl $0x7f, %eax
je 0x9d36
shll $0x18, %eax
addl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x1ffffff, %eax        # imm = 0x1FFFFFF
jle 0x9d08
movl %ebp, 0x40(%r14)
leaq 0x50(%rsp), %rdi
callq 0x4290
leaq 0x60(%rsp), %r15
leaq 0x4967(%rip), %rsi      # 0xe6b7
movl $0x6, %edx
movq %r15, %rdi
callq 0x4460
callq 0x45f0
movq %r15, %rdi
movl %eax, %esi
callq 0x4760
movq %rax, %r15
leaq 0x478c(%rip), %rsi      # 0xe502
movl $0x4, %edx
movq %rax, %rdi
callq 0x4460
movl 0x40(%r14), %esi
movq %r15, %rdi
callq 0x4760
leaq 0x68(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x4690
leaq 0x30(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x44b0
movq (%r14), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x9dc8
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43e0
movq 0x91c1(%rip), %rsi      # 0x12f90
leaq 0x50(%rsp), %rdi
callq 0x42d0
leaq 0xd0(%rsp), %rdi
callq 0x4160
movb $0x1, %bl
jmp 0x9dfc
movl %ebp, %edi
callq 0x47e0
jmp 0x9dfa
movl %ebp, %edi
callq 0x47e0
xorl %ebx, %ebx
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x9e13
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43e0
movb $0x1, %al
andb %bl, %al
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, %edi
movl $0x1, %esi
callq 0x43b0
movl %ebp, %edi
callq 0x47e0
movq (%r15), %r9
movq $0x0, (%rsp)
leaq 0x484e(%rip), %rdi      # 0xe69c
leaq 0x484c(%rip), %rdx      # 0xe6a1
leaq 0x484e(%rip), %rcx      # 0xe6aa
leaq 0x4851(%rip), %r8       # 0xe6b4
movq %rdi, %rsi
xorl %eax, %eax
callq 0x4120
movl $0x1, %edi
callq 0x44a0
jmp 0x9eb9
jmp 0x9e7f
jmp 0x9eb9
jmp 0x9eb9
movq %rax, %rbx
movq 0x9107(%rip), %rsi      # 0x12f90
leaq 0x50(%rsp), %rdi
callq 0x42d0
leaq 0xd0(%rsp), %rdi
callq 0x4160
jmp 0x9ebc
jmp 0x9eb9
jmp 0x9ea6
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x9ec6
jmp 0x9ed3
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x9ed3
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43e0
movq %rbx, %rdi
callq 0x4770
nop