#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*/ prefix;

/* Variables and functions */
int /*<<< orphan*/ dbgmem_dump_blocks();
scalar_t__ logger_write_fileline(int, char *, int, char *);
scalar_t__ snprintf(char *, int, char *, char *, int);
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  int res = 0;
  char prefix[512 + 5] = "";
  if (snprintf(prefix, sizeof(prefix), "%s:%d:test\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/asmodehn/Workshop/refs/heads/"
               "master/C/Logger/test/DebugInfoTest.c",
               18) &&
      logger_write_fileline(
          1,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/asmodehn/Workshop/refs/heads/master/C/"
          "Logger/test/DebugInfoTest.c",
          18, ("test\n")) != strlen(prefix)) {
    res = 1;
  }
  dbgmem_dump_blocks();
  return res;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x220(%rbp),%rdi
xor    %esi,%esi
mov    $0x205,%edx
call   1050 <memset@plt>
lea    -0x220(%rbp),%rdi
mov    $0x205,%esi
lea    0xe6a(%rip),%rdx
lea    0xe6f(%rip),%rcx
mov    $0x12,%r8d
call   1040 <snprintf@plt>
cmp    $0x0,%rax
je     11fc <main+0xac>
mov    $0x1,%edi
lea    0xe4e(%rip),%rsi
mov    $0x12,%edx
lea    0xe3c(%rip),%rcx
call   1060 <logger_write_fileline@plt>
mov    %rax,-0x228(%rbp)
lea    -0x220(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x228(%rbp),%rax
cmp    %rcx,%rax
je     11fc <main+0xac>
movl   $0x1,-0x14(%rbp)
mov    $0x0,%al
call   1070 <dbgmem_dump_blocks@plt>
mov    -0x14(%rbp),%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rsp,%r14
xor    %ebx,%ebx
mov    $0x205,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
lea    0xe8b(%rip),%rdx
lea    0xe90(%rip),%rcx
mov    %r14,%rdi
mov    $0x205,%esi
mov    $0x12,%r8d
call   1040 <snprintf@plt>
test   %rax,%rax
je     11c4 <main+0x74>
lea    0xe71(%rip),%rsi
lea    0xe64(%rip),%rcx
mov    $0x1,%edi
mov    $0x12,%edx
call   1060 <logger_write_fileline@plt>
mov    %rax,%r14
mov    %rsp,%rdi
call   1030 <strlen@plt>
xor    %ebx,%ebx
cmp    %rax,%r14
setne  %bl
xor    %eax,%eax
call   1070 <dbgmem_dump_blocks@plt>
mov    %ebx,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%s:%d:test\0A\00"
@.str.1 = [156 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/asmodehn/Workshop/refs/heads/master/C/Logger/test/DebugInfoTest.c\00"
@.str.2 = [6 x i8] c"test\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [517 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%8 = bitcast [517 x i8]* %7 to i8*
%9 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%10 = call i64 @snprintf(i8* %9, i32 517, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str.1, i64 0, i64 0), i32 18)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = call i64 @logger_write_fileline(i32 1, i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str.1, i64 0, i64 0), i32 18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%14 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%15 = call i64 @strlen(i8* %14)
%16 = icmp ne i64 %13, %15
br i1 %16, label %17, label %18
17: ; preds = %12
store i32 1, i32* %6
br label %18
18: ; preds = %17, %12, %2
%19 = call i32 (...) @dbgmem_dump_blocks()
%20 = load i32, i32* %6
ret i32 %20
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s:%d:test\0A\00"
@.str.1 = [156 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/asmodehn/Workshop/refs/heads/master/C/Logger/test/DebugInfoTest.c\00"
@.str.2 = [6 x i8] c"test\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [517 x i8]
%4 = getelementptr inbounds [517 x i8], [517 x i8]* %3, i64 0, i64 0
%5 = call i64 @snprintf(i8* %4, i32 517, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str.1, i64 0, i64 0), i32 18)
%6 = icmp eq i64 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = call i64 @logger_write_fileline(i32 1, i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str.1, i64 0, i64 0), i32 18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%9 = call i64 @strlen(i8* %4)
%10 = icmp ne i64 %8, %9
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %7, %2
%13 = phi i32 [ 0, %2 ], [ %11, %7 ]
%14 = call i32 (...) @dbgmem_dump_blocks()
ret i32 %13
}