#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 */
scalar_t__ common_test();
scalar_t__ definition_list_test();
scalar_t__ label_log_test();
int /*<<< orphan*/ printf(char *, char *, int, ...);
scalar_t__ string_lookup_test();
scalar_t__ types_test();
int run_tests(void) {
  int tests_failed = 0;
  printf("[%s:%d] Starting unit tests\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/ge4096/system-from-scratch/refs/heads/"
         "master/asm/test/test.c",
         11);
  tests_failed += common_test();
  tests_failed += types_test();
  tests_failed += string_lookup_test();
  tests_failed += definition_list_test();
  tests_failed += label_log_test();
  printf("[%s:%d] %d tests failed\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/ge4096/system-from-scratch/refs/heads/"
         "master/asm/test/test.c",
         19, tests_failed);
  return tests_failed;
}


x86 assembly (clang, -O0):
<run_tests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    0xea0(%rip),%rsi
mov    $0xb,%edx
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <common_test@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <types_test@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1080 <string_lookup_test@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1060 <definition_list_test@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <label_log_test@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
lea    0xebd(%rip),%rdi
lea    0xe1f(%rip),%rsi
mov    $0x13,%edx
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_tests>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xe91(%rip),%rdi
lea    0xea7(%rip),%r14
mov    %r14,%rsi
mov    $0xb,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1070 <common_test@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1030 <types_test@plt>
mov    %rax,%r12
add    %r15d,%r12d
xor    %eax,%eax
call   1080 <string_lookup_test@plt>
mov    %rax,%rbx
add    %r12d,%ebx
xor    %eax,%eax
call   1060 <definition_list_test@plt>
mov    %rax,%r15
add    %ebx,%r15d
xor    %eax,%eax
call   1040 <label_log_test@plt>
mov    %rax,%rbx
add    %r15d,%ebx
lea    0xeea(%rip),%rdi
mov    %r14,%rsi
mov    $0x13,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [29 x i8] c"[%s:%d] Starting unit tests\0A\00"
@.str.1 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ge4096/system-from-scratch/refs/heads/master/asm/test/test.c\00"
@.str.2 = [25 x i8] c"[%s:%d] %d tests failed\0A\00"
define i32 @run_tests() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 11)
%3 = call i64 (...) @common_test()
%4 = load i32, i32* %1
%5 = sext i32 %4 to i64
%6 = add nsw i64 %5, %3
%7 = trunc i64 %6 to i32
store i32 %7, i32* %1
%8 = call i64 (...) @types_test()
%9 = load i32, i32* %1
%10 = sext i32 %9 to i64
%11 = add nsw i64 %10, %8
%12 = trunc i64 %11 to i32
store i32 %12, i32* %1
%13 = call i64 (...) @string_lookup_test()
%14 = load i32, i32* %1
%15 = sext i32 %14 to i64
%16 = add nsw i64 %15, %13
%17 = trunc i64 %16 to i32
store i32 %17, i32* %1
%18 = call i64 (...) @definition_list_test()
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = add nsw i64 %20, %18
%22 = trunc i64 %21 to i32
store i32 %22, i32* %1
%23 = call i64 (...) @label_log_test()
%24 = load i32, i32* %1
%25 = sext i32 %24 to i64
%26 = add nsw i64 %25, %23
%27 = trunc i64 %26 to i32
store i32 %27, i32* %1
%28 = load i32, i32* %1
%29 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 19, i32 %28)
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [29 x i8] c"[%s:%d] Starting unit tests\0A\00"
@.str.1 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ge4096/system-from-scratch/refs/heads/master/asm/test/test.c\00"
@.str.2 = [25 x i8] c"[%s:%d] %d tests failed\0A\00"
define i32 @run_tests() {
%1 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 11)
%2 = tail call i64 (...) @common_test()
%3 = tail call i64 (...) @types_test()
%4 = add i64 %3, %2
%5 = tail call i64 (...) @string_lookup_test()
%6 = add i64 %4, %5
%7 = tail call i64 (...) @definition_list_test()
%8 = add i64 %6, %7
%9 = tail call i64 (...) @label_log_test()
%10 = add i64 %8, %9
%11 = trunc i64 %10 to i32
%12 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 19, i32 %11)
ret i32 %11
}