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

/* Variables and functions */
int /*<<< orphan*/ elev_init();
int /*<<< orphan*/ initEventManager(int *, int *, int *, int *,
                                    int /*<<< orphan*/ *);
void *malloc(int);
int /*<<< orphan*/ printf(char *);
int main() {
  if (!elev_init()) {
    printf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/Lunarage/elevproj-ntnu/refs/heads/master/"
           "src/main.c"
           ": Unable to initialize elevator hardware\n");
    return 1;
  }
  int *orderlist = malloc(sizeof(int));
  int *previousFloor = malloc(sizeof(int));
  int *direction = malloc(sizeof(int));
  int *state = malloc(sizeof(int));
  time_t *timer = malloc(sizeof(time_t));
  initEventManager(orderlist, previousFloor, direction, state, timer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <elev_init@plt>
cmp    $0x0,%eax
jne    1177 <main+0x37>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11dd <main+0x9d>
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1030 <initEventManager@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <elev_init@plt>
test   %eax,%eax
je     11a9 <main+0x69>
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%r12
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    %rax,%r8
call   1030 <initEventManager@plt>
jmp    11ba <main+0x7a>
lea    0xe50(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [183 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Lunarage/elevproj-ntnu/refs/heads/master/src/main.c: Unable to initialize elevator hardware\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32 0, i32* %1
%7 = call i32 (...) @elev_init()
%8 = icmp ne i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([183 x i8], [183 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %28
11: ; preds = %0
%12 = call i8* @malloc(i32 4)
%13 = bitcast i8* %12 to i32*
store i32* %13, i32** %2
%14 = call i8* @malloc(i32 4)
%15 = bitcast i8* %14 to i32*
store i32* %15, i32** %3
%16 = call i8* @malloc(i32 4)
%17 = bitcast i8* %16 to i32*
store i32* %17, i32** %4
%18 = call i8* @malloc(i32 4)
%19 = bitcast i8* %18 to i32*
store i32* %19, i32** %5
%20 = call i8* @malloc(i32 4)
%21 = bitcast i8* %20 to i32*
store i32* %21, i32** %6
%22 = load i32*, i32** %2
%23 = load i32*, i32** %3
%24 = load i32*, i32** %4
%25 = load i32*, i32** %5
%26 = load i32*, i32** %6
%27 = call i32 @initEventManager(i32* %22, i32* %23, i32* %24, i32* %25, i32* %26)
store i32 0, i32* %1
br label %28
28: ; preds = %11, %9
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@str = [182 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Lunarage/elevproj-ntnu/refs/heads/master/src/main.c: Unable to initialize elevator hardware\00"
define i32 @main() {
%1 = tail call i32 (...) @elev_init()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([182 x i8], [182 x i8]* @str, i64 0, i64 0))
br label %17
5: ; preds = %0
%6 = tail call dereferenceable_or_null(4) i8* @malloc(i32 4)
%7 = bitcast i8* %6 to i32*
%8 = tail call dereferenceable_or_null(4) i8* @malloc(i32 4)
%9 = bitcast i8* %8 to i32*
%10 = tail call dereferenceable_or_null(4) i8* @malloc(i32 4)
%11 = bitcast i8* %10 to i32*
%12 = tail call dereferenceable_or_null(4) i8* @malloc(i32 4)
%13 = bitcast i8* %12 to i32*
%14 = tail call dereferenceable_or_null(4) i8* @malloc(i32 4)
%15 = bitcast i8* %14 to i32*
%16 = tail call i32 @initEventManager(i32* %7, i32* %9, i32* %11, i32* %13, i32* %15)
br label %17
17: ; preds = %5, %3
%18 = phi i32 [ 0, %5 ], [ 1, %3 ]
ret i32 %18
}