#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ buff;

/* Variables and functions */
int /*<<< orphan*/ log_debug(char *);
int /*<<< orphan*/ log_error(char *, ...);
int /*<<< orphan*/ log_info(char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, int);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int main() {
  {
    char buff[4096] = {0};
    snprintf(buff, sizeof(buff), "FILE = %s LINE = %d\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/Furzoom/demo-C/refs/heads/master/src/"
             "network/event/test.c",
             6);
    int len = strlen(buff);
    strncat(buff + len, "Not found", sizeof(buff) - len - 1);
    log_error(buff);
  };
  {
    char buff[4096] = {0};
    snprintf(buff, sizeof(buff), "FILE = %s LINE = %d\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/Furzoom/demo-C/refs/heads/master/src/"
             "network/event/test.c",
             7);
    int len = strlen(buff);
    strncat(buff + len, "ret = %d", sizeof(buff) - len - 1);
    log_info(buff, 10);
  };
  {
    char buff[4096] = {0};
    snprintf(buff, sizeof(buff), "FILE = %s LINE = %d\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/Furzoom/demo-C/refs/heads/master/src/"
             "network/event/test.c",
             8);
    int len = strlen(buff);
    strncat(buff + len, "a = 10", sizeof(buff) - len - 1);
    log_debug(buff);
  };
  {
    char buff[4096] = {0};
    snprintf(buff, sizeof(buff), "FILE = %s LINE = %d\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/Furzoom/demo-C/refs/heads/master/src/"
             "network/event/test.c",
             9);
    int len = strlen(buff);
    strncat(buff + len, "ret = %d", sizeof(buff) - len - 1);
    log_error(buff, 10);
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4050,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1010(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1080 <memset@plt>
lea    -0x1010(%rbp),%rdi
mov    $0x1000,%esi
lea    0xe58(%rip),%rdx
lea    0xe66(%rip),%rcx
mov    $0x6,%r8d
call   1060 <snprintf@plt>
lea    -0x1010(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x1014(%rbp)
lea    -0x1010(%rbp),%rdi
movslq -0x1014(%rbp),%rax
add    %rax,%rdi
movslq -0x1014(%rbp),%rcx
mov    $0x1000,%eax
sub    %rcx,%rax
sub    $0x1,%rax
mov    %eax,%edx
lea    0xeb0(%rip),%rsi
call   1090 <strncat@plt>
lea    -0x1010(%rbp),%rdi
mov    $0x0,%al
call   1040 <log_error@plt>
lea    -0x2020(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1080 <memset@plt>
lea    -0x2020(%rbp),%rdi
mov    $0x1000,%esi
lea    0xdce(%rip),%rdx
lea    0xddc(%rip),%rcx
mov    $0x7,%r8d
call   1060 <snprintf@plt>
lea    -0x2020(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x2024(%rbp)
lea    -0x2020(%rbp),%rdi
movslq -0x2024(%rbp),%rax
add    %rax,%rdi
movslq -0x2024(%rbp),%rcx
mov    $0x1000,%eax
sub    %rcx,%rax
sub    $0x1,%rax
mov    %eax,%edx
lea    0xe30(%rip),%rsi
call   1090 <strncat@plt>
lea    -0x2020(%rbp),%rdi
mov    $0xa,%esi
call   1030 <log_info@plt>
lea    -0x3030(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1080 <memset@plt>
lea    -0x3030(%rbp),%rdi
mov    $0x1000,%esi
lea    0xd41(%rip),%rdx
lea    0xd4f(%rip),%rcx
mov    $0x8,%r8d
call   1060 <snprintf@plt>
lea    -0x3030(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x3034(%rbp)
lea    -0x3030(%rbp),%rdi
movslq -0x3034(%rbp),%rax
add    %rax,%rdi
movslq -0x3034(%rbp),%rcx
mov    $0x1000,%eax
sub    %rcx,%rax
sub    $0x1,%rax
mov    %eax,%edx
lea    0xdac(%rip),%rsi
call   1090 <strncat@plt>
lea    -0x3030(%rbp),%rdi
call   1070 <log_debug@plt>
lea    -0x4040(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1080 <memset@plt>
lea    -0x4040(%rbp),%rdi
mov    $0x1000,%esi
lea    0xcb9(%rip),%rdx
lea    0xcc7(%rip),%rcx
mov    $0x9,%r8d
call   1060 <snprintf@plt>
lea    -0x4040(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x4044(%rbp)
lea    -0x4040(%rbp),%rdi
movslq -0x4044(%rbp),%rax
add    %rax,%rdi
movslq -0x4044(%rbp),%rcx
mov    $0x1000,%eax
sub    %rcx,%rax
sub    $0x1,%rax
mov    %eax,%edx
lea    0xd1b(%rip),%rsi
call   1090 <strncat@plt>
lea    -0x4040(%rbp),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1040 <log_error@plt>
xor    %eax,%eax
add    $0x4050,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1000,%rsp
mov    %rsp,%rbx
mov    $0x1000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <memset@plt>
lea    0xe68(%rip),%r12
lea    0xe76(%rip),%r14
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %r12,%rdx
mov    %r14,%rcx
mov    $0x6,%r8d
call   1060 <snprintf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rdi
mov    $0xfff,%ebp
mov    $0xfff,%edx
sub    %eax,%edx
lea    0xed0(%rip),%rsi
call   1090 <strncat@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <log_error@plt>
mov    %rsp,%rbx
mov    $0x1000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <memset@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %r12,%rdx
mov    %r14,%rcx
mov    $0x7,%r8d
call   1060 <snprintf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rdi
mov    $0xfff,%edx
sub    %eax,%edx
lea    0xe84(%rip),%r15
mov    %r15,%rsi
call   1090 <strncat@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <log_info@plt>
mov    %rsp,%rbx
mov    $0x1000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <memset@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %r12,%rdx
mov    %r14,%rcx
mov    $0x8,%r8d
call   1060 <snprintf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rdi
mov    $0xfff,%edx
sub    %eax,%edx
lea    0xe31(%rip),%rsi
call   1090 <strncat@plt>
mov    %rbx,%rdi
call   1070 <log_debug@plt>
mov    %rsp,%rbx
mov    $0x1000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <memset@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %r12,%rdx
mov    %r14,%rcx
mov    $0x9,%r8d
call   1060 <snprintf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rdi
sub    %eax,%ebp
mov    %r15,%rsi
mov    %ebp,%edx
call   1090 <strncat@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <log_error@plt>
xor    %eax,%eax
add    $0x1000,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"FILE = %s LINE = %d\0A\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Furzoom/demo-C/refs/heads/master/src/network/event/test.c\00"
@.str.2 = [10 x i8] c"Not found\00"
@.str.3 = [9 x i8] c"ret = %d\00"
@.str.4 = [7 x i8] c"a = 10\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4096 x i8]
%3 = alloca i32
%4 = alloca [4096 x i8]
%5 = alloca i32
%6 = alloca [4096 x i8]
%7 = alloca i32
%8 = alloca [4096 x i8]
%9 = alloca i32
store i32 0, i32* %1
%10 = bitcast [4096 x i8]* %2 to i8*
%11 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%12 = call i32 @snprintf(i8* %11, i32 4096, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 6)
%13 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
store i32 %14, i32* %3
%15 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = sub i64 4096, %20
%22 = sub i64 %21, 1
%23 = trunc i64 %22 to i32
%24 = call i32 @strncat(i8* %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%26 = call i32 (i8*, ...) @log_error(i8* %25)
%27 = bitcast [4096 x i8]* %4 to i8*
%28 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%29 = call i32 @snprintf(i8* %28, i32 4096, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 7)
%30 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%31 = call i32 @strlen(i8* %30)
store i32 %31, i32* %5
%32 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = sub i64 4096, %37
%39 = sub i64 %38, 1
%40 = trunc i64 %39 to i32
%41 = call i32 @strncat(i8* %35, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%43 = call i32 @log_info(i8* %42, i32 10)
%44 = bitcast [4096 x i8]* %6 to i8*
%45 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%46 = call i32 @snprintf(i8* %45, i32 4096, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 8)
%47 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%48 = call i32 @strlen(i8* %47)
store i32 %48, i32* %7
%49 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
%53 = load i32, i32* %7
%54 = sext i32 %53 to i64
%55 = sub i64 4096, %54
%56 = sub i64 %55, 1
%57 = trunc i64 %56 to i32
%58 = call i32 @strncat(i8* %52, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %57)
%59 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%60 = call i32 @log_debug(i8* %59)
%61 = bitcast [4096 x i8]* %8 to i8*
%62 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%63 = call i32 @snprintf(i8* %62, i32 4096, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 9)
%64 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%65 = call i32 @strlen(i8* %64)
store i32 %65, i32* %9
%66 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%67 = load i32, i32* %9
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %66, i64 %68
%70 = load i32, i32* %9
%71 = sext i32 %70 to i64
%72 = sub i64 4096, %71
%73 = sub i64 %72, 1
%74 = trunc i64 %73 to i32
%75 = call i32 @strncat(i8* %69, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %74)
%76 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%77 = call i32 (i8*, ...) @log_error(i8* %76, i32 10)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"FILE = %s LINE = %d\0A\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Furzoom/demo-C/refs/heads/master/src/network/event/test.c\00"
@.str.2 = [10 x i8] c"Not found\00"
@.str.3 = [9 x i8] c"ret = %d\00"
@.str.4 = [7 x i8] c"a = 10\00"
define i32 @main() {
%1 = alloca [4096 x i8]
%2 = alloca [4096 x i8]
%3 = alloca [4096 x i8]
%4 = alloca [4096 x i8]
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%6 = call i32 @snprintf(i8* %5, i32 4096, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 6)
%7 = call i32 @strlen(i8* %5)
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %8
%10 = sub i32 4095, %7
%11 = call i32 @strncat(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = call i32 (i8*, ...) @log_error(i8* %5)
%13 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%14 = call i32 @snprintf(i8* %13, i32 4096, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 7)
%15 = call i32 @strlen(i8* %13)
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 %16
%18 = sub i32 4095, %15
%19 = call i32 @strncat(i8* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = call i32 @log_info(i8* %13, i32 10)
%21 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%22 = call i32 @snprintf(i8* %21, i32 4096, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 8)
%23 = call i32 @strlen(i8* %21)
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %24
%26 = sub i32 4095, %23
%27 = call i32 @strncat(i8* %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %26)
%28 = call i32 @log_debug(i8* %21)
%29 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%30 = call i32 @snprintf(i8* %29, i32 4096, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 9)
%31 = call i32 @strlen(i8* %29)
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 %32
%34 = sub i32 4095, %31
%35 = call i32 @strncat(i8* %33, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = call i32 (i8*, ...) @log_error(i8* %29, i32 10)
ret i32 0
}