#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 */
struct cheat_test_suite {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cheat_test_assert(struct cheat_test_suite *,
                                     int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ printf(char *, int);
void test_segfault(struct cheat_test_suite *suite) {
  int *foo = NULL;
  printf("%d", *foo);
  cheat_test_assert(
      suite, 0, "0",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/Tordek/cheat/refs/heads/master/sampletest.c",
      68);
}


x86 assembly (clang, -O0):
<test_segfault>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
lea    0xeb0(%rip),%rdx
lea    0xeab(%rip),%rcx
mov    $0x44,%r8d
call   1040 <cheat_test_assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_segfault>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdx
lea    0xec7(%rip),%rcx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x44,%r8d
pop    %rbx
jmp    1040 <cheat_test_assert@plt>

LLVM IR (-O0):
%struct.cheat_test_suite = type { i32 }
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Tordek/cheat/refs/heads/master/sampletest.c\00"
define void @test_segfault(%struct.cheat_test_suite* %0) {
%2 = alloca %struct.cheat_test_suite*
%3 = alloca i32*
store %struct.cheat_test_suite* %0, %struct.cheat_test_suite** %2
store i32* null, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load %struct.cheat_test_suite*, %struct.cheat_test_suite** %2
%8 = call i32 @cheat_test_assert(%struct.cheat_test_suite* %7, i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str.2, i64 0, i64 0), i32 68)
ret void
}

LLVM IR (-O2):
%struct.cheat_test_suite = type { i32 }
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Tordek/cheat/refs/heads/master/sampletest.c\00"
define void @test_segfault(%struct.cheat_test_suite* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 undef)
%3 = tail call i32 @cheat_test_assert(%struct.cheat_test_suite* %0, i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str.2, i64 0, i64 0), i32 68)
ret void
}