#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 test_suite {
  int dummy;
};
struct test_context {
  int dummy;
};

/* Variables and functions */
scalar_t__ memcmp(char const *, char const *, size_t);
int /*<<< orphan*/ test_abort(struct test_context *, char *, int, char *,
                              char const *, size_t, ...);
int /*<<< orphan*/ test_format_data(char const *, size_t);
void test_case_memory_failure_4(struct test_suite *test_suite,
                                struct test_context *test_context) {
  do {
    const char *value__ = (const char *)(NULL);
    size_t value_sz__ = 0;
    const char *expected__ = (const char *)("foobar");
    size_t expected_sz__ = 3;
    const char *value_str_ = "NULL";
    if (value__ && expected__) {
      if (value_sz__ != expected_sz__) {
        test_abort(test_context,
                   "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/galdor/libutest/refs/"
                   "heads/master/tests/main.c",
                   95,
                   "%s is %zu bytes long but should be "
                   "%zu bytes long",
                   value_str_, value_sz__, expected_sz__);
      }
      if (memcmp(value__, expected__, value_sz__) != 0) {
        test_abort(test_context,
                   "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/galdor/libutest/refs/"
                   "heads/master/tests/main.c",
                   95,
                   "%s contains \"%s\" "
                   "but should contain \"%s\"",
                   value_str_, test_format_data(value__, value_sz__),
                   test_format_data(expected__, expected_sz__));
      }
    } else if (expected__) {
      test_abort(test_context,
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/galdor/libutest/refs/heads/"
                 "master/tests/main.c",
                 95, "%s is null but should be the string \"%s\"", value_str_,
                 test_format_data(expected__, expected_sz__));
    } else if (value__) {
      test_abort(test_context,
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/galdor/libutest/refs/heads/"
                 "master/tests/main.c",
                 95, "%s is the string \"%s\" but should be null", value_str_,
                 test_format_data(value__, value_sz__));
    }
  } while (0);
}


x86 assembly (clang, -O0):
<test_case_memory_failure_4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xea6(%rip),%rax
mov    %rax,-0x28(%rbp)
movq   $0x3,-0x30(%rbp)
lea    0xe9a(%rip),%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     123c <test_case_memory_failure_4+0x10c>
cmpq   $0x0,-0x28(%rbp)
je     123c <test_case_memory_failure_4+0x10c>
mov    -0x20(%rbp),%rax
cmp    -0x30(%rbp),%rax
je     11c3 <test_case_memory_failure_4+0x93>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%r8
mov    -0x20(%rbp),%r9
mov    -0x30(%rbp),%rax
lea    0xe60(%rip),%rsi
mov    $0x5f,%edx
lea    0xedd(%rip),%rcx
mov    %rax,(%rsp)
mov    $0x0,%al
call   1050 <test_abort@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
je     1237 <test_case_memory_failure_4+0x107>
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <test_format_data@plt>
cltq
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <test_format_data@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%r8
mov    -0x40(%rbp),%r9
lea    0xdeb(%rip),%rsi
mov    $0x5f,%edx
lea    0xe9a(%rip),%rcx
mov    %eax,(%rsp)
mov    $0x0,%al
call   1050 <test_abort@plt>
jmp    12e5 <test_case_memory_failure_4+0x1b5>
cmpq   $0x0,-0x28(%rbp)
je     128e <test_case_memory_failure_4+0x15e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <test_format_data@plt>
mov    -0x60(%rbp),%rdi
mov    -0x58(%rbp),%r8
movslq %eax,%r9
lea    0xd96(%rip),%rsi
mov    $0x5f,%edx
lea    0xe6e(%rip),%rcx
mov    $0x0,%al
call   1050 <test_abort@plt>
jmp    12e0 <test_case_memory_failure_4+0x1b0>
cmpq   $0x0,-0x18(%rbp)
je     12db <test_case_memory_failure_4+0x1ab>
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <test_format_data@plt>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%r8
movslq %eax,%r9
lea    0xd44(%rip),%rsi
mov    $0x5f,%edx
lea    0xe45(%rip),%rcx
mov    $0x0,%al
call   1050 <test_abort@plt>
jmp    12e0 <test_case_memory_failure_4+0x1b0>
jmp    12e5 <test_case_memory_failure_4+0x1b5>
jmp    12ea <test_case_memory_failure_4+0x1ba>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_case_memory_failure_4>:
push   %rbx
mov    %rsi,%rbx
lea    0xed5(%rip),%rdi
mov    $0x3,%esi
call   1030 <test_format_data@plt>
movslq %eax,%r9
lea    0xecd(%rip),%rsi
lea    0xf4f(%rip),%rcx
lea    0xeba(%rip),%r8
mov    %rbx,%rdi
mov    $0x5f,%edx
xor    %eax,%eax
pop    %rbx
jmp    1040 <test_abort@plt>

LLVM IR (-O0):
%struct.test_suite = type { i32 }
%struct.test_context = type { i32 }
@.str = [7 x i8] c"foobar\00"
@.str.1 = [5 x i8] c"NULL\00"
@.str.2 = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/galdor/libutest/refs/heads/master/tests/main.c\00"
@.str.3 = [50 x i8] c"%s is %zu bytes long but should be %zu bytes long\00"
@.str.4 = [41 x i8] c"%s contains \22%s\22 but should contain \22%s\22\00"
@.str.5 = [41 x i8] c"%s is null but should be the string \22%s\22\00"
@.str.6 = [41 x i8] c"%s is the string \22%s\22 but should be null\00"
define void @test_case_memory_failure_4(%struct.test_suite* %0, %struct.test_context* %1) {
%3 = alloca %struct.test_suite*
%4 = alloca %struct.test_context*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
store %struct.test_suite* %0, %struct.test_suite** %3
store %struct.test_context* %1, %struct.test_context** %4
br label %10
10: ; preds = %2
store i8* null, i8** %5
store i64 0, i64* %6
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %7
store i64 3, i64* %8
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %9
%11 = load i8*, i8** %5
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %44
13: ; preds = %10
%14 = load i8*, i8** %7
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %44
16: ; preds = %13
%17 = load i64, i64* %6
%18 = load i64, i64* %8
%19 = icmp ne i64 %17, %18
br i1 %19, label %20, label %26
20: ; preds = %16
%21 = load %struct.test_context*, %struct.test_context** %4
%22 = load i8*, i8** %9
%23 = load i64, i64* %6
%24 = load i64, i64* %8
%25 = call i32 (%struct.test_context*, i8*, i32, i8*, i8*, i64, ...) @test_abort(%struct.test_context* %21, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.2, i64 0, i64 0), i32 95, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i8* %22, i64 %23, i64 %24)
br label %26
26: ; preds = %20, %16
%27 = load i8*, i8** %5
%28 = load i8*, i8** %7
%29 = load i64, i64* %6
%30 = call i64 @memcmp(i8* %27, i8* %28, i64 %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %43
32: ; preds = %26
%33 = load %struct.test_context*, %struct.test_context** %4
%34 = load i8*, i8** %9
%35 = load i8*, i8** %5
%36 = load i64, i64* %6
%37 = call i32 @test_format_data(i8* %35, i64 %36)
%38 = sext i32 %37 to i64
%39 = load i8*, i8** %7
%40 = load i64, i64* %8
%41 = call i32 @test_format_data(i8* %39, i64 %40)
%42 = call i32 (%struct.test_context*, i8*, i32, i8*, i8*, i64, ...) @test_abort(%struct.test_context* %33, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.2, i64 0, i64 0), i32 95, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %34, i64 %38, i32 %41)
br label %43
43: ; preds = %32, %26
br label %68
44: ; preds = %13, %10
%45 = load i8*, i8** %7
%46 = icmp ne i8* %45, null
br i1 %46, label %47, label %55
47: ; preds = %44
%48 = load %struct.test_context*, %struct.test_context** %4
%49 = load i8*, i8** %9
%50 = load i8*, i8** %7
%51 = load i64, i64* %8
%52 = call i32 @test_format_data(i8* %50, i64 %51)
%53 = sext i32 %52 to i64
%54 = call i32 (%struct.test_context*, i8*, i32, i8*, i8*, i64, ...) @test_abort(%struct.test_context* %48, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.2, i64 0, i64 0), i32 95, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i8* %49, i64 %53)
br label %67
55: ; preds = %44
%56 = load i8*, i8** %5
%57 = icmp ne i8* %56, null
br i1 %57, label %58, label %66
58: ; preds = %55
%59 = load %struct.test_context*, %struct.test_context** %4
%60 = load i8*, i8** %9
%61 = load i8*, i8** %5
%62 = load i64, i64* %6
%63 = call i32 @test_format_data(i8* %61, i64 %62)
%64 = sext i32 %63 to i64
%65 = call i32 (%struct.test_context*, i8*, i32, i8*, i8*, i64, ...) @test_abort(%struct.test_context* %59, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.2, i64 0, i64 0), i32 95, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), i8* %60, i64 %64)
br label %66
66: ; preds = %58, %55
br label %67
67: ; preds = %66, %47
br label %68
68: ; preds = %67, %43
br label %69
69: ; preds = %68
ret void
}

LLVM IR (-O2):
%struct.test_suite = type { i32 }
%struct.test_context = type { i32 }
@.str = [7 x i8] c"foobar\00"
@.str.1 = [5 x i8] c"NULL\00"
@.str.2 = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/galdor/libutest/refs/heads/master/tests/main.c\00"
@.str.5 = [41 x i8] c"%s is null but should be the string \22%s\22\00"
define void @test_case_memory_failure_4(%struct.test_suite* nocapture readnone %0, %struct.test_context* %1) {
%3 = tail call i32 @test_format_data(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 3)
%4 = sext i32 %3 to i64
%5 = tail call i32 (%struct.test_context*, i8*, i32, i8*, i8*, i64, ...) @test_abort(%struct.test_context* %1, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.2, i64 0, i64 0), i32 95, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %4)
ret void
}