#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 ft_display_file(char *);
int /*<<< orphan*/ ft_putstr(char *);
int main(int ac, char **av) {
  if (ac != 2) {
    if (ac < 2)
      ft_putstr("File name missing.\n");
    if (ac > 2)
      ft_putstr("Too many arguments.\n");
    return (1);
  } else {
    if (ft_display_file(av[1]) == 1)
      return (1);
    return (0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1178 <main+0x58>
cmpl   $0x2,-0x8(%rbp)
jge    1156 <main+0x36>
lea    0xeaf(%rip),%rdi
call   1040 <ft_putstr@plt>
cmpl   $0x2,-0x8(%rbp)
jle    116c <main+0x4c>
lea    0xead(%rip),%rdi
call   1040 <ft_putstr@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a1 <main+0x81>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <ft_display_file@plt>
cmp    $0x1,%eax
jne    119a <main+0x7a>
movl   $0x1,-0x4(%rbp)
jmp    11a1 <main+0x81>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    113b <main+0x1b>
mov    0x8(%rsi),%rdi
call   1030 <ft_display_file@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
sete   %al
pop    %rcx
ret
jge    1146 <main+0x26>
lea    0xebc(%rip),%rdi
jmp    114d <main+0x2d>
lea    0xec7(%rip),%rdi
call   1040 <ft_putstr@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"File name missing.\0A\00"
@.str.1 = [21 x i8] c"Too many arguments.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %19
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @ft_putstr(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @ft_putstr(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
store i32 1, i32* %3
br label %27
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @ft_display_file(i8* %22)
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %26
25: ; preds = %19
store i32 1, i32* %3
br label %27
26: ; preds = %19
store i32 0, i32* %3
br label %27
27: ; preds = %26, %25, %18
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [20 x i8] c"File name missing.\0A\00"
@.str.1 = [21 x i8] c"Too many arguments.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @ft_putstr(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %16
8: ; preds = %4
%9 = tail call i32 @ft_putstr(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %16
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @ft_display_file(i8* %12)
%14 = icmp eq i32 %13, 1
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %6, %10, %8
%17 = phi i32 [ 1, %8 ], [ 1, %6 ], [ %15, %10 ]
ret i32 %17
}