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

/* Variables and functions */
char CHAR_BIT;
int /*<<< orphan*/ assert_eq(char *, int, char, int);
int /*<<< orphan*/ assert_true(char *, int, int);
int /*<<< orphan*/ expect_streq(char *, int, char *, char *);
char snprintf(char *, int, char *);
void test_posix_sanity(void) {
  assert_eq(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/craigbarnes/dte/refs/heads/master/test/main.c",
      31, CHAR_BIT, 8);
  assert_true(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/craigbarnes/dte/refs/heads/master/test/main.c",
      32, sizeof(int) >= 4);

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wpragmas"

#pragma GCC diagnostic ignored "-Wformat-truncation"

  char buf[8] = "........";
  assert_eq(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/craigbarnes/dte/refs/heads/master/test/main.c",
      40, snprintf(buf, 8, "0123456789"), 10);
  assert_eq(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/craigbarnes/dte/refs/heads/master/test/main.c",
      41, buf[7], '\0');
  expect_streq(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/craigbarnes/dte/refs/heads/master/test/main.c",
      42, buf, "0123456");
  assert_eq(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/craigbarnes/dte/refs/heads/master/test/main.c",
      46, snprintf(NULL, 0, "987654321"), 9);

#pragma GCC diagnostic pop
}


x86 assembly (clang, -O0):
<test_posix_sanity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x1f,%esi
mov    $0x8,%ecx
mov    0x2e80(%rip),%rax
movsbl (%rax),%edx
call   1030 <assert_eq@plt>
lea    0xe91(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
call   1040 <assert_true@plt>
mov    0xf20(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x8,%esi
lea    0xeef(%rip),%rdx
call   1050 <snprintf@plt>
lea    0xe5b(%rip),%rdi
mov    $0x28,%esi
mov    $0xa,%ecx
movsbl %al,%edx
call   1030 <assert_eq@plt>
lea    0xe42(%rip),%rdi
mov    $0x29,%esi
xor    %ecx,%ecx
movsbl -0x1(%rbp),%edx
call   1030 <assert_eq@plt>
lea    -0x8(%rbp),%rdx
lea    0xe27(%rip),%rdi
mov    $0x2a,%esi
lea    0xeae(%rip),%rcx
call   1060 <expect_streq@plt>
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
lea    0xea4(%rip),%rdx
call   1050 <snprintf@plt>
lea    0xdfd(%rip),%rdi
mov    $0x2e,%esi
mov    $0x9,%ecx
movsbl %al,%edx
call   1030 <assert_eq@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_posix_sanity>:
push   %r14
push   %rbx
push   %rax
mov    0x2e95(%rip),%rax
movsbl (%rax),%edx
lea    0xeab(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1f,%esi
mov    $0x8,%ecx
call   1030 <assert_eq@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
mov    $0x1,%edx
call   1040 <assert_true@plt>
movabs $0x2e2e2e2e2e2e2e2e,%rax
2e 2e 2e
mov    %rax,(%rsp)
lea    0xefa(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x8,%esi
call   1050 <snprintf@plt>
movsbl %al,%edx
mov    %rbx,%rdi
mov    $0x28,%esi
mov    $0xa,%ecx
call   1030 <assert_eq@plt>
movsbl 0x7(%rsp),%edx
mov    %rbx,%rdi
mov    $0x29,%esi
xor    %ecx,%ecx
call   1030 <assert_eq@plt>
lea    0xec5(%rip),%rcx
mov    %rbx,%rdi
mov    $0x2a,%esi
mov    %r14,%rdx
call   1060 <expect_streq@plt>
lea    0xeb6(%rip),%rdx
xor    %edi,%edi
xor    %esi,%esi
call   1050 <snprintf@plt>
movsbl %al,%edx
mov    %rbx,%rdi
mov    $0x2e,%esi
mov    $0x9,%ecx
call   1030 <assert_eq@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/craigbarnes/dte/refs/heads/master/test/main.c\00"
@CHAR_BIT = global i8 0
@__const.test_posix_sanity.buf = [8 x i8] c"........"
@.str.1 = [11 x i8] c"0123456789\00"
@.str.2 = [8 x i8] c"0123456\00"
@.str.3 = [10 x i8] c"987654321\00"
define void @test_posix_sanity() {
%1 = alloca [8 x i8]
%2 = load i8, i8* @CHAR_BIT
%3 = call i32 @assert_eq(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 31, i8 signext %2, i32 8)
%4 = call i32 @assert_true(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 32, i32 1)
%5 = bitcast [8 x i8]* %1 to i8*
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%7 = call signext i8 @snprintf(i8* %6, i32 8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @assert_eq(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 40, i8 signext %7, i32 10)
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 7
%10 = load i8, i8* %9
%11 = call i32 @assert_eq(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 41, i8 signext %10, i32 0)
%12 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%13 = call i32 @expect_streq(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 42, i8* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%14 = call signext i8 @snprintf(i8* null, i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @assert_eq(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 46, i8 signext %14, i32 9)
ret void
}

LLVM IR (-O2):
@.str = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/craigbarnes/dte/refs/heads/master/test/main.c\00"
@CHAR_BIT = global i8 0
@.str.1 = [11 x i8] c"0123456789\00"
@.str.2 = [8 x i8] c"0123456\00"
@.str.3 = [10 x i8] c"987654321\00"
define void @test_posix_sanity() {
%1 = alloca i64
%2 = bitcast i64* %1 to [8 x i8]*
%3 = load i8, i8* @CHAR_BIT
%4 = tail call i32 @assert_eq(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 31, i8 signext %3, i32 8)
%5 = tail call i32 @assert_true(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 32, i32 1)
%6 = bitcast i64* %1 to i8*
store i64 3327647950551526958, i64* %1
%7 = call signext i8 @snprintf(i8* %6, i32 8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @assert_eq(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 40, i8 signext %7, i32 10)
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 7
%10 = load i8, i8* %9
%11 = call i32 @assert_eq(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 41, i8 signext %10, i32 0)
%12 = call i32 @expect_streq(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 42, i8* %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%13 = call signext i8 @snprintf(i8* null, i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @assert_eq(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 46, i8 signext %13, i32 9)
ret void
}