#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  FILE *file;
  int i, k;
  char s[100];
  if (argc < 2) {
  nothing:;
    printf("0");
    return 0;
  }
  file = fopen(argv[1], "r");
  if (file == NULL)
    goto nothing;
  fclose(file);
  sprintf(s, "file -L %s", argv[1]);
  system(s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1190 <main+0x40>
jmp    1178 <main+0x28>
lea    0xe81(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ef <main+0x9f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe63(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11b8 <main+0x68>
jmp    1178 <main+0x28>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe2d(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x90(%rbp),%rdi
call   1040 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
cmp    $0x1,%edi
jle    119a <main+0x4a>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe98(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     119a <main+0x4a>
mov    %rax,%rdi
call   1040 <fclose@plt>
mov    0x8(%rbx),%rdx
lea    0xe7d(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
jmp    11a4 <main+0x54>
mov    $0x30,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"file -L %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %15
12: ; preds = %2
br label %13
13: ; preds = %22, %12
%14 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %33
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %6
%20 = load i32*, i32** %6
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %23
22: ; preds = %15
br label %13
23: ; preds = %15
%24 = load i32*, i32** %6
%25 = call i32 @fclose(i32* %24)
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @sprintf(i8* %26, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%32 = call i32 @system(i8* %31)
store i32 0, i32* %3
br label %33
33: ; preds = %23, %13
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"file -L %s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %8
6: ; preds = %8, %2
%7 = tail call i32 @putchar(i32 48)
br label %18
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %6, label %13
13: ; preds = %8
%14 = tail call i32 @fclose(i32* %11)
%15 = load i8*, i8** %9
%16 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = call i32 @system(i8* %4)
br label %18
18: ; preds = %13, %6
ret i32 0
}