// File: /workspace/github_cpp_makefile_star2_O1/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, %r12d
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, 0x28(%rsp)
leaq 0x5a38(%rip), %rcx      # 0xf672
movl $0x6, %edx
movq %rsi, %rdi
xorl %esi, %esi
callq 0x4520
testl %eax, %eax
je 0x9cc0
leaq 0x5a2d(%rip), %rcx      # 0xf681
movl $0x7, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x4520
testl %eax, %eax
jne 0x9d99
leaq 0x5a17(%rip), %rcx      # 0xf689
movl $0x8, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x4520
testl %eax, %eax
je 0x9d99
leaq 0x8(%rsp), %r13
movl $0x7, %edx
movq %r13, %rdi
movq %r15, %rsi
movq $-0x1, %rcx
callq 0x4400
leaq 0x59dd(%rip), %rcx      # 0xf689
movl $0x8, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4450
jmp 0x9d13
leaq 0x59b2(%rip), %rcx      # 0xf679
movl $0x7, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x4520
testl %eax, %eax
je 0x9c4d
leaq 0x8(%rsp), %r13
movl $0x6, %edx
movq %r13, %rdi
movq %r15, %rsi
movq $-0x1, %rcx
callq 0x4400
leaq 0x5978(%rip), %rcx      # 0xf679
movl $0x7, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4450
leaq 0x60(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x9d3a
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x9d41
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq 0x50(%rsp), %r13
movq %rdx, 0x8(%r13)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r15, %rdi
movq %r13, %rsi
callq 0x44b0
movq (%r13), %rdi
cmpq %r14, %rdi
je 0x9d7e
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x43e0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9d99
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x43e0
leaq 0xa7f0(%rip), %rax      # 0x14590
movq (%rax), %r13
movq 0x8(%rax), %r14
cmpq %r14, %r13
setne %bpl
je 0x9e10
movq 0x8(%r13), %rdx
movq %r15, %rdi
xorl %esi, %esi
movq %r13, %rcx
callq 0x4500
testl %eax, %eax
je 0x9deb
addq $0x20, %r13
cmpq %r14, %r13
setne %bpl
je 0x9e10
movq 0x8(%r13), %rdx
movq %r15, %rdi
xorl %esi, %esi
movq %r13, %rcx
callq 0x4500
addq $0x20, %r13
testl %eax, %eax
jne 0x9dc9
testb $0x3, %r12b
je 0x9e27
movq 0x8(%rbx), %rdx
leaq 0x5896(%rip), %rcx      # 0xf692
movl $0x9, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4660
movb $0x1, %bl
jmp 0x9e10
andb %bl, %bpl
movl %ebp, %eax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xa771(%rip), %rax      # 0x145a8
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x8ff2
movq (%r12), %rdi
callq 0x4140
movl %eax, %r12d
cmpl $-0x1, %eax
je 0x9faa
movq 0x8(%rsp), %rdi
callq 0x41d0
callq 0x40f0
cmpl $-0x1, %eax
je 0x9fa2
movl %eax, %r13d
testl %eax, %eax
je 0x9fd5
leaq 0x50(%rsp), %r15
movl %r13d, %edi
movq %r15, %rsi
xorl %edx, %edx
callq 0x4320
cmpl $-0x1, %eax
je 0x9ec4
movl 0x50(%rsp), %eax
andl $0x7f, %eax
je 0x9ed4
shll $0x18, %eax
addl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x2000000, %eax        # imm = 0x2000000
movl $0x0, %r14d
movl $0x6, %eax
cmovgel %eax, %r14d
jmp 0x9eda
movl $0x1, %r14d
movl %r12d, %edi
callq 0x47e0
jmp 0x9eda
movl $0x6, %r14d
testl %r14d, %r14d
je 0x9e8b
cmpl $0x6, %r14d
jne 0x9fae
movq 0x28(%rsp), %r14
movl %r12d, 0x40(%r14)
leaq 0x50(%rsp), %rdi
callq 0x4290
leaq 0x60(%rsp), %r15
leaq 0x57af(%rip), %rsi      # 0xf6b7
movl $0x6, %edx
movq %r15, %rdi
callq 0x4460
callq 0x45f0
movq %r15, %rdi
movl %eax, %esi
callq 0x4760
movq %rax, %r15
leaq 0x55d4(%rip), %rsi      # 0xf502
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 0x9f80
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43e0
movq 0xa009(%rip), %rsi      # 0x13f90
leaq 0x50(%rsp), %rdi
callq 0x42d0
leaq 0xd0(%rsp), %rdi
callq 0x4160
movb $0x1, %bl
jmp 0x9fb0
movl %r12d, %edi
callq 0x47e0
xorl %ebx, %ebx
jmp 0x9fb5
xorl %ebx, %ebx
leaq 0x18(%rsp), %r14
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x9e10
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x43e0
jmp 0x9e10
movl %r12d, %edi
movl $0x1, %esi
callq 0x43b0
movl %r12d, %edi
callq 0x47e0
movq (%r15), %r9
movq $0x0, (%rsp)
leaq 0x56a0(%rip), %rdi      # 0xf69c
leaq 0x569e(%rip), %rdx      # 0xf6a1
leaq 0x56a0(%rip), %rcx      # 0xf6aa
leaq 0x56a3(%rip), %r8       # 0xf6b4
movq %rdi, %rsi
xorl %eax, %eax
callq 0x4120
movl $0x1, %edi
callq 0x44a0
jmp 0xa02b
jmp 0xa060
jmp 0xa060
movq %rax, %rbx
movq 0x9f5b(%rip), %rsi      # 0x13f90
leaq 0x50(%rsp), %rdi
callq 0x42d0
leaq 0xd0(%rsp), %rdi
callq 0x4160
jmp 0xa063
jmp 0xa060
jmp 0xa052
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0xa06d
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xa07f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x43e0
movq %rbx, %rdi
callq 0x4770
nop