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

/* Variables and functions */
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ las_tell_header(int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  FILE *f;
  if (argc > 1) {
    errno = 0;
    f = fopen(argv[1], "r");
    if (!f) {
      perror("las");
      exit(-1);
    }
    las_tell_header(f);
  } else {
    puts("Not enough arguments");
  }
  return 0;
}


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)
cmpl   $0x1,-0x8(%rbp)
jle    11c5 <main+0x75>
mov    0x2e69(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe73(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11b7 <main+0x67>
lea    0xe5a(%rip),%rdi
call   1060 <perror@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1040 <las_tell_header@plt>
jmp    11d1 <main+0x81>
lea    0xe3a(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jl     1183 <main+0x33>
mov    0x2e83(%rip),%rax
movq   $0x0,(%rax)
mov    0x8(%rsi),%rdi
lea    0xe91(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1193 <main+0x43>
mov    %rax,%rdi
call   1040 <las_tell_header@plt>
jmp    118f <main+0x3f>
lea    0xe7c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe68(%rip),%rdi
call   1060 <perror@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@errno = global i64 0
@.str = [2 x i8] c"r\00"
@.str.1 = [4 x i8] c"las\00"
@.str.2 = [21 x i8] c"Not enough arguments\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %22
9: ; preds = %2
store i64 0, i64* @errno
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %13, i32** %6
%14 = load i32*, i32** %6
%15 = icmp ne i32* %14, null
br i1 %15, label %19, label %16
16: ; preds = %9
%17 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %9
%20 = load i32*, i32** %6
%21 = call i32 @las_tell_header(i32* %20)
br label %24
22: ; preds = %2
%23 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
ret i32 0
}

LLVM IR (-O2):
@errno = global i64 0
@.str = [2 x i8] c"r\00"
@.str.1 = [4 x i8] c"las\00"
@.str.2 = [21 x i8] c"Not enough arguments\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %14
4: ; preds = %2
store i64 0, i64* @errno
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = tail call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @exit(i32 -1)
unreachable
12: ; preds = %4
%13 = tail call i32 @las_tell_header(i32* %7)
br label %16
14: ; preds = %2
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
ret i32 0
}