#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 edid1_info {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ check_edid(struct edid1_info *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
struct edid1_info *load_edid(char *);
int /*<<< orphan*/ print_edid(struct edid1_info *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  struct edid1_info *edid_info = NULL;
  if (argc != 2) {
    printf("usage: edid <eeprom_file>\n");
    exit(EXIT_FAILURE);
  }
  edid_info = load_edid(argv[1]);
  if (!edid_info || !check_edid(edid_info)) {
    printf("no edid\n");
    exit(EXIT_FAILURE);
  }
  print_edid(edid_info);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1192 <main+0x42>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <load_edid@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11c0 <main+0x70>
mov    -0x18(%rbp),%rdi
call   1040 <check_edid@plt>
cmp    $0x0,%eax
jne    11da <main+0x8a>
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1050 <print_edid@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    117c <main+0x2c>
mov    0x8(%rsi),%rdi
call   1070 <load_edid@plt>
test   %rax,%rax
je     1173 <main+0x23>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <check_edid@plt>
test   %eax,%eax
jne    1196 <main+0x46>
lea    0xe86(%rip),%rdi
jmp    1183 <main+0x33>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    %rbx,%rdi
call   1050 <print_edid@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.edid1_info = type { i32 }
@.str = [27 x i8] c"usage: edid <eeprom_file>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [9 x i8] c"no edid\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.edid1_info*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.edid1_info* null, %struct.edid1_info** %6
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call %struct.edid1_info* @load_edid(i8* %16)
store %struct.edid1_info* %17, %struct.edid1_info** %6
%18 = load %struct.edid1_info*, %struct.edid1_info** %6
%19 = icmp ne %struct.edid1_info* %18, null
br i1 %19, label %20, label %24
20: ; preds = %13
%21 = load %struct.edid1_info*, %struct.edid1_info** %6
%22 = call i32 @check_edid(%struct.edid1_info* %21)
%23 = icmp ne i32 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %20, %13
%25 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%26 = load i32, i32* @EXIT_FAILURE
%27 = call i32 @exit(i32 %26)
unreachable
28: ; preds = %20
%29 = load %struct.edid1_info*, %struct.edid1_info** %6
%30 = call i32 @print_edid(%struct.edid1_info* %29)
%31 = load i32, i32* @EXIT_SUCCESS
%32 = call i32 @exit(i32 %31)
unreachable
}

LLVM IR (-O2):
%struct.edid1_info = type { i32 }
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [8 x i8] c"no edid\00"
@str.2 = [26 x i8] c"usage: edid <eeprom_file>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.2, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call %struct.edid1_info* @load_edid(i8* %10)
%12 = icmp eq %struct.edid1_info* %11, null
br i1 %12, label %16, label %13
13: ; preds = %8
%14 = tail call i32 @check_edid(%struct.edid1_info* %11)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13, %8
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%18 = load i32, i32* @EXIT_FAILURE
%19 = tail call i32 @exit(i32 %18)
unreachable
20: ; preds = %13
%21 = tail call i32 @print_edid(%struct.edid1_info* %11)
%22 = load i32, i32* @EXIT_SUCCESS
%23 = tail call i32 @exit(i32 %22)
unreachable
}