#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 */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ exit(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int read(int, char *, int);
int /*<<< orphan*/ test_me(int, int);
int main(int argc, char *argv[]) {
  char buffer[8];
  int fd, x, y;
  if (argc != 2) {
    printf("Usage: %s <file>\n", argv[0]);
    exit(-1);
  }
  fd = open(argv[1], O_RDONLY);
  do {
    if (!(fd != -1)) {
      perror("open");
      exit(-1);
    }
  } while (0);
  do {
    if (!(read(fd, buffer, 8) == 8)) {
      perror("read");
      exit(-1);
    }
  } while (0);
  x = *(unsigned int *)&buffer[0];
  y = *(unsigned int *)&buffer[4];
  test_me(x, y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     119d <main+0x3d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e3c(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    11d6 <main+0x76>
lea    0xe4b(%rip),%rdi
call   1070 <perror@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
jmp    11db <main+0x7b>
jmp    11e0 <main+0x80>
mov    -0x1c(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x8,%edx
call   1050 <read@plt>
cmp    $0x8,%eax
je     1210 <main+0xb0>
lea    0xe16(%rip),%rdi
call   1070 <perror@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
jmp    1215 <main+0xb5>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1040 <test_me@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    11a1 <main+0x41>
mov    0x8(%rsi),%rdi
mov    0x2e77(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
cmp    $0xffffffff,%eax
je     11ba <main+0x5a>
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0x8,%edx
call   1050 <read@plt>
cmp    $0x8,%eax
jne    11c3 <main+0x63>
mov    (%rsp),%edi
mov    0x4(%rsp),%esi
call   1040 <test_me@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    (%rsi),%rsi
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
lea    0xe51(%rip),%rdi
jmp    11ca <main+0x6a>
lea    0xe4d(%rip),%rdi
call   1070 <perror@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: %s <file>\0A\00"
@O_RDONLY = global i32 0
@.str.1 = [5 x i8] c"open\00"
@.str.2 = [5 x i8] c"read\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 -1)
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = load i32, i32* @O_RDONLY
%23 = call i32 @open(i8* %21, i32 %22)
store i32 %23, i32* %7
br label %24
24: ; preds = %18
%25 = load i32, i32* %7
%26 = icmp ne i32 %25, -1
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 @exit(i32 -1)
unreachable
30: ; preds = %24
br label %31
31: ; preds = %30
br label %32
32: ; preds = %31
%33 = load i32, i32* %7
%34 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%35 = call i32 @read(i32 %33, i8* %34, i32 8)
%36 = icmp eq i32 %35, 8
br i1 %36, label %40, label %37
37: ; preds = %32
%38 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%39 = call i32 @exit(i32 -1)
unreachable
40: ; preds = %32
br label %41
41: ; preds = %40
%42 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%43 = bitcast i8* %42 to i32*
%44 = load i32, i32* %43
store i32 %44, i32* %8
%45 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 4
%46 = bitcast i8* %45 to i32*
%47 = load i32, i32* %46
store i32 %47, i32* %9
%48 = load i32, i32* %8
%49 = load i32, i32* %9
%50 = call i32 @test_me(i32 %48, i32 %49)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s <file>\0A\00"
@O_RDONLY = global i32 0
@.str.1 = [5 x i8] c"open\00"
@.str.2 = [5 x i8] c"read\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [8 x i8]
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = tail call i32 @exit(i32 -1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = load i32, i32* @O_RDONLY
%14 = tail call i32 @open(i8* %12, i32 %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %19
16: ; preds = %10
%17 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 @exit(i32 -1)
unreachable
19: ; preds = %10
%20 = call i32 @read(i32 %14, i8* %4, i32 8)
%21 = icmp eq i32 %20, 8
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%24 = tail call i32 @exit(i32 -1)
unreachable
25: ; preds = %19
%26 = bitcast [8 x i8]* %3 to i32*
%27 = load i32, i32* %26
%28 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 4
%29 = bitcast i8* %28 to i32*
%30 = load i32, i32* %29
%31 = tail call i32 @test_me(i32 %27, i32 %30)
ret i32 0
}