int start_data_trans(int fd, char *ext_arg, int cmd_count, char *stat) {
  int ret;
  char buf[4096];
  memset(buf, 0x0, sizeof(buf));
  sprintf(buf, "%s %s %04d", "--start-data-byJamesL", ext_arg, cmd_count);
  printf("--<%s:%d>--<%s>--"
         "sent head: %s"
         "--\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/princeofdream/debug_src_full/refs/heads/"
         "master/network_utils/remote_debug/remote_debug_base.c",
         401, __FUNCTION__, buf);
  ret = write(fd, buf, strlen(buf));
  memset(buf, 0x0, sizeof(buf));
  ret = read(fd, buf, sizeof(buf));
  printf("--<%s:%d>--<%s>--"
         "get head: %s"
         "--\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/princeofdream/debug_src_full/refs/heads/"
         "master/network_utils/remote_debug/remote_debug_base.c",
         406, __FUNCTION__, buf);
  memcpy(stat, buf, sizeof(buf));
  return ret;
}


x86 assembly (clang, -O0):
<start_data_trans>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1040,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x1030(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1060 <memset@plt>
lea    -0x1030(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
lea    0xe4e(%rip),%rsi
lea    0xe52(%rip),%rdx
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0x1030(%rbp),%r8
lea    0xe53(%rip),%rdi
lea    0xe6e(%rip),%rsi
mov    $0x191,%edx
lea    0xf1a(%rip),%rcx
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x103c(%rbp)
lea    -0x1030(%rbp),%rax
mov    %rax,-0x1038(%rbp)
lea    -0x1030(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x103c(%rbp),%edi
mov    -0x1038(%rbp),%rsi
mov    %rax,%rdx
mov    $0x0,%al
call   1030 <write@plt>
mov    %eax,-0x24(%rbp)
lea    -0x1030(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1060 <memset@plt>
mov    -0x4(%rbp),%edi
lea    -0x1030(%rbp),%rsi
mov    $0x1000,%edx
mov    $0x0,%al
call   1070 <read@plt>
mov    %eax,-0x24(%rbp)
lea    -0x1030(%rbp),%r8
lea    0xead(%rip),%rdi
lea    0xddd(%rip),%rsi
mov    $0x196,%edx
lea    0xe89(%rip),%rcx
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
lea    -0x1030(%rbp),%rsi
mov    $0x1000,%edx
call   1080 <memcpy@plt>
mov    -0x24(%rbp),%eax
add    $0x1040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_data_trans>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1008,%rsp
mov    %rcx,%r14
mov    %edx,%r15d
mov    %rsi,%rbp
mov    %edi,%r13d
mov    %rsp,%rbx
mov    $0x1000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xe5a(%rip),%rsi
lea    0xe5e(%rip),%rdx
mov    %rbx,%rdi
mov    %rbp,%rcx
mov    %r15d,%r8d
xor    %eax,%eax
call   1090 <sprintf@plt>
lea    0xe5d(%rip),%rdi
lea    0xe78(%rip),%r12
lea    0xf29(%rip),%r15
mov    %r12,%rsi
mov    $0x191,%edx
mov    %r15,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <write@plt>
mov    $0x1000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
mov    $0x1000,%edx
mov    %r13d,%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <read@plt>
mov    %eax,%ebp
lea    0xee3(%rip),%rdi
mov    %r12,%rsi
mov    $0x196,%edx
mov    %r15,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1000,%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <memcpy@plt>
mov    %ebp,%eax
add    $0x1008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%s %s %04d\00"
@.str.1 = [22 x i8] c"--start-data-byJamesL\00"
@.str.2 = [34 x i8] c"--<%s:%d>--<%s>--sent head: %s--\0A\00"
@.str.3 = [184 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/princeofdream/debug_src_full/refs/heads/master/network_utils/remote_debug/remote_debug_base.c\00"
@__FUNCTION__.start_data_trans = [17 x i8] c"start_data_trans\00"
@.str.4 = [33 x i8] c"--<%s:%d>--<%s>--get head: %s--\0A\00"
define i32 @start_data_trans(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca [4096 x i8]
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%11 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%12 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%13 = load i8*, i8** %6
%14 = load i32, i32* %7
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %13, i32 %14)
%16 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([184 x i8], [184 x i8]* @.str.3, i64 0, i64 0), i32 401, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.start_data_trans, i64 0, i64 0), i8* %16)
%18 = load i32, i32* %5
%19 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%20 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%21 = call i64 @strlen(i8* %20)
%22 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 %18, i8* %19, i64 %21)
store i32 %22, i32* %9
%23 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%24 = load i32, i32* %5
%25 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%26 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @read to i32 (i32, i8*, i64, ...)*)(i32 %24, i8* %25, i64 4096)
store i32 %26, i32* %9
%27 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([184 x i8], [184 x i8]* @.str.3, i64 0, i64 0), i32 406, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.start_data_trans, i64 0, i64 0), i8* %27)
%29 = load i8*, i8** %8
%30 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%31 = load i32, i32* %9
ret i32 %31
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s %s %04d\00"
@.str.1 = [22 x i8] c"--start-data-byJamesL\00"
@.str.2 = [34 x i8] c"--<%s:%d>--<%s>--sent head: %s--\0A\00"
@.str.3 = [184 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/princeofdream/debug_src_full/refs/heads/master/network_utils/remote_debug/remote_debug_base.c\00"
@__FUNCTION__.start_data_trans = [17 x i8] c"start_data_trans\00"
@.str.4 = [33 x i8] c"--<%s:%d>--<%s>--get head: %s--\0A\00"
define i32 @start_data_trans(i32 %0, i8* %1, i32 %2, i8* nocapture writeonly %3) {
%5 = alloca [4096 x i8]
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%7 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %2)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([184 x i8], [184 x i8]* @.str.3, i64 0, i64 0), i32 401, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.start_data_trans, i64 0, i64 0), i8* %6)
%9 = call i64 @strlen(i8* %6)
%10 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 %0, i8* %6, i64 %9)
%11 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @read to i32 (i32, i8*, i64, ...)*)(i32 %0, i8* %6, i64 4096)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([184 x i8], [184 x i8]* @.str.3, i64 0, i64 0), i32 406, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.start_data_trans, i64 0, i64 0), i8* %6)
ret i32 %11
}