#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*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ get_overscan(int, unsigned int *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int, unsigned int,
                          unsigned int);
int /*<<< orphan*/ set_overscan(int, unsigned int *);
unsigned int strtoul(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int file_desc;
  unsigned coord[4];
  file_desc = open("/dev/vcio", 0);
  if (file_desc == -1)
    exit(1);
  if (argc == 5) {
    for (int i = 0; i < 4; i++)
      if (argc > 1 + i)
        coord[i] = strtoul(argv[1 + i], 0, 0);
    set_overscan(file_desc, coord);
  } else {
    get_overscan(file_desc, coord);
    printf("%d %d %d %d\n", coord[0], coord[1], coord[2], coord[3]);
  }
  close(file_desc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe73(%rip),%rdi
xor    %esi,%esi
call   1070 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    11ab <main+0x3b>
mov    $0x1,%edi
call   1090 <exit@plt>
cmpl   $0x5,-0x8(%rbp)
jne    121f <main+0xaf>
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
jge    120e <main+0x9e>
mov    -0x8(%rbp),%eax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jle    11fb <main+0x8b>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1080 <strtoul@plt>
mov    %eax,%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    1200 <main+0x90>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11bc <main+0x4c>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1040 <set_overscan@plt>
jmp    1244 <main+0xd4>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1030 <get_overscan@plt>
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x24(%rbp),%r8d
lea    0xdcb(%rip),%rdi
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe7c(%rip),%rdi
xor    %esi,%esi
call   1070 <open@plt>
cmp    $0xffffffff,%eax
je     1226 <main+0xb6>
mov    %eax,%r14d
cmp    $0x5,%ebp
jne    11ec <main+0x7c>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %eax,(%rsp)
mov    0x10(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %eax,0x4(%rsp)
mov    0x18(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %eax,0x8(%rsp)
mov    0x20(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %eax,0xc(%rsp)
mov    %rsp,%rsi
mov    %r14d,%edi
call   1040 <set_overscan@plt>
jmp    1213 <main+0xa3>
mov    %rsp,%rsi
mov    %r14d,%edi
call   1030 <get_overscan@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    0xc(%rsp),%r8d
lea    0xdfc(%rip),%rdi
call   1050 <printf@plt>
mov    %r14d,%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"/dev/vcio\00"
@.str.1 = [13 x i8] c"%d %d %d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [4 x i32]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 5
br i1 %16, label %17, label %45
17: ; preds = %14
store i32 0, i32* %8
br label %18
18: ; preds = %38, %17
%19 = load i32, i32* %8
%20 = icmp slt i32 %19, 4
br i1 %20, label %21, label %41
21: ; preds = %18
%22 = load i32, i32* %4
%23 = load i32, i32* %8
%24 = add nsw i32 1, %23
%25 = icmp sgt i32 %22, %24
br i1 %25, label %26, label %37
26: ; preds = %21
%27 = load i8**, i8*** %5
%28 = load i32, i32* %8
%29 = add nsw i32 1, %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %27, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @strtoul(i8* %32, i32 0, i32 0)
%34 = load i32, i32* %8
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 %35
store i32 %33, i32* %36
br label %37
37: ; preds = %26, %21
br label %38
38: ; preds = %37
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
br label %18
41: ; preds = %18
%42 = load i32, i32* %6
%43 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%44 = call i32 @set_overscan(i32 %42, i32* %43)
br label %58
45: ; preds = %14
%46 = load i32, i32* %6
%47 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%48 = call i32 @get_overscan(i32 %46, i32* %47)
%49 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%50 = load i32, i32* %49
%51 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 1
%52 = load i32, i32* %51
%53 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 2
%54 = load i32, i32* %53
%55 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 3
%56 = load i32, i32* %55
%57 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %50, i32 %52, i32 %54, i32 %56)
br label %58
58: ; preds = %45, %41
%59 = load i32, i32* %6
%60 = call i32 @close(i32 %59)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"/dev/vcio\00"
@.str.1 = [13 x i8] c"%d %d %d %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4 x i32]
%4 = bitcast [4 x i32]* %3 to i8*
%5 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = icmp eq i32 %0, 5
br i1 %10, label %11, label %29
11: ; preds = %9
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @strtoul(i8* %13, i32 0, i32 0)
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
store i32 %14, i32* %15
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @strtoul(i8* %17, i32 0, i32 0)
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 1
store i32 %18, i32* %19
%20 = getelementptr inbounds i8*, i8** %1, i64 3
%21 = load i8*, i8** %20
%22 = tail call i32 @strtoul(i8* %21, i32 0, i32 0)
%23 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 2
store i32 %22, i32* %23
%24 = getelementptr inbounds i8*, i8** %1, i64 4
%25 = load i8*, i8** %24
%26 = tail call i32 @strtoul(i8* %25, i32 0, i32 0)
%27 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 3
store i32 %26, i32* %27
%28 = call i32 @set_overscan(i32 %5, i32* %15)
br label %40
29: ; preds = %9
%30 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%31 = call i32 @get_overscan(i32 %5, i32* %30)
%32 = load i32, i32* %30
%33 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 1
%34 = load i32, i32* %33
%35 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 2
%36 = load i32, i32* %35
%37 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 3
%38 = load i32, i32* %37
%39 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %32, i32 %34, i32 %36, i32 %38)
br label %40
40: ; preds = %29, %11
%41 = call i32 @close(i32 %5)
ret i32 0
}