int end_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", "--end-data-byJamesL", ext_arg, cmd_count);
  printf("--<%s:%d>--<%s>--"
         "buffer: %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",
         418, __FUNCTION__, buf);
  ret = write(fd, buf, strlen(buf));
  memset(buf, 0x0, sizeof(buf));
  ret = read(fd, buf, sizeof(buf));
  printf("--<%s:%d>--<%s>--"
         "buffer: %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",
         423, __FUNCTION__, buf);
  if (strncmp(buf, "finish", strlen("finish")) != 0) {
  }
  memcpy(stat, buf, sizeof(buf));
  return ret;
}


x86 assembly (clang, -O0):
<end_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   1070 <memset@plt>
lea    -0x1030(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
lea    0xe3e(%rip),%rsi
lea    0xe42(%rip),%rdx
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x1030(%rbp),%r8
lea    0xe41(%rip),%rdi
lea    0xe59(%rip),%rsi
mov    $0x1a2,%edx
lea    0xf05(%rip),%rcx
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x103c(%rbp)
lea    -0x1030(%rbp),%rax
mov    %rax,-0x1038(%rbp)
lea    -0x1030(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x103c(%rbp),%edi
mov    -0x1038(%rbp),%rsi
mov    %rax,%rdx
mov    $0x0,%al
call   1040 <write@plt>
mov    %eax,-0x24(%rbp)
lea    -0x1030(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1070 <memset@plt>
mov    -0x4(%rbp),%edi
lea    -0x1030(%rbp),%rsi
mov    $0x1000,%edx
mov    $0x0,%al
call   1080 <read@plt>
mov    %eax,-0x24(%rbp)
lea    -0x1030(%rbp),%r8
lea    0xdb0(%rip),%rdi
lea    0xdc8(%rip),%rsi
mov    $0x1a7,%edx
lea    0xe74(%rip),%rcx
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x1030(%rbp),%rdi
lea    0xe6e(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     12af <end_data_trans+0x12f>
jmp    12af <end_data_trans+0x12f>
mov    -0x20(%rbp),%rdi
lea    -0x1030(%rbp),%rsi
mov    $0x1000,%edx
call   1090 <memcpy@plt>
mov    -0x24(%rbp),%eax
add    $0x1040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<end_data_trans>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1018,%rsp
mov    %rcx,0x8(%rsp)
mov    %edx,%r15d
mov    %rsi,%rbp
mov    %edi,%r14d
lea    0x10(%rsp),%rbx
mov    $0x1000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xe56(%rip),%rsi
lea    0xe5a(%rip),%rdx
mov    %rbx,%rdi
mov    %rbp,%rcx
mov    %r15d,%r8d
xor    %eax,%eax
call   1090 <sprintf@plt>
lea    0xe57(%rip),%r12
lea    0xe6f(%rip),%r13
lea    0xf20(%rip),%r15
mov    %r12,%rdi
mov    %r13,%rsi
mov    $0x1a2,%edx
mov    %r15,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14d,%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    %r14d,%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <read@plt>
mov    %eax,%ebp
mov    %r12,%rdi
mov    %r13,%rsi
mov    $0x1a7,%edx
mov    %r15,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1000,%edx
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1080 <memcpy@plt>
mov    %ebp,%eax
add    $0x1018,%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 = [20 x i8] c"--end-data-byJamesL\00"
@.str.2 = [31 x i8] c"--<%s:%d>--<%s>--buffer: %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__.end_data_trans = [15 x i8] c"end_data_trans\00"
@.str.4 = [7 x i8] c"finish\00"
define i32 @end_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 ([20 x i8], [20 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 ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([184 x i8], [184 x i8]* @.str.3, i64 0, i64 0), i32 418, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.end_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 ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([184 x i8], [184 x i8]* @.str.3, i64 0, i64 0), i32 423, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.end_data_trans, i64 0, i64 0), i8* %27)
%29 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%30 = call i32 @strncmp(i8* %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i64 6)
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %4
br label %33
33: ; preds = %32, %4
%34 = load i8*, i8** %8
%35 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%36 = load i32, i32* %9
ret i32 %36
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s %s %04d\00"
@.str.1 = [20 x i8] c"--end-data-byJamesL\00"
@.str.2 = [31 x i8] c"--<%s:%d>--<%s>--buffer: %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__.end_data_trans = [15 x i8] c"end_data_trans\00"
define i32 @end_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 ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %2)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([184 x i8], [184 x i8]* @.str.3, i64 0, i64 0), i32 418, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.end_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 ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([184 x i8], [184 x i8]* @.str.3, i64 0, i64 0), i32 423, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.end_data_trans, i64 0, i64 0), i8* %6)
ret i32 %11
}