#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 */
int /*<<< orphan*/ align(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  FILE *file = stdin;
  file = fopen(argv[1], "r");
  if (argc < 2) {
    printf("please enter a filename\n");
    printf("[program name] [filename]\n");
    return -1;
  }
  align(file, stdout);
}


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)
mov    0x2e9b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9d(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    119a <main+0x6a>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ac <main+0x7c>
mov    -0x18(%rbp),%rdi
mov    0x2e33(%rip),%rax
mov    (%rax),%esi
call   1040 <align@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
cmp    $0x1,%ebx
jg     1167 <main+0x37>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
mov    0x2e72(%rip),%rcx
mov    (%rcx),%esi
mov    %rax,%rdi
call   1040 <align@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@.str.1 = [25 x i8] c"please enter a filename\0A\00"
@.str.2 = [27 x i8] c"[program name] [filename]\0A\00"
@stdout = global i32 0
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** @stdin
store i32* %7, i32** %6
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %6
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %21
17: ; preds = %2
%18 = load i32*, i32** %6
%19 = load i32, i32* @stdout
%20 = call i32 @align(i32* %18, i32 %19)
br label %21
21: ; preds = %17, %14
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@stdout = global i32 0
@str = [24 x i8] c"please enter a filename\00"
@str.3 = [26 x i8] c"[program name] [filename]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp slt i32 %0, 2
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.3, i64 0, i64 0))
br label %13
10: ; preds = %2
%11 = load i32, i32* @stdout
%12 = tail call i32 @align(i32* %5, i32 %11)
br label %13
13: ; preds = %10, %7
%14 = phi i32 [ -1, %7 ], [ 0, %10 ]
ret i32 %14
}