#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 */
char *ft_file_to_str(char *);
int /*<<< orphan*/ ft_handle_bsq(char *);
int /*<<< orphan*/ ft_puterr(char *);
int /*<<< orphan*/ ft_stdin_file();
int main(int argc, char **argv) {
  char *map;
  int i;
  i = 0;
  if (argc != 1)
    i = 1;
  while (i < argc) {
    if (argc == 1) {
      ft_stdin_file();
      map = ft_file_to_str("temp");
      i++;
    } else
      map = ft_file_to_str(argv[i++]);
    if (!map)
      ft_puterr("map error\n");
    else
      ft_handle_bsq(map);
  }
  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)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     116e <main+0x2e>
movl   $0x1,-0x1c(%rbp)
jmp    1173 <main+0x33>
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f7 <main+0xb7>
cmpl   $0x1,-0x8(%rbp)
jne    11ae <main+0x6e>
mov    $0x0,%al
call   1030 <ft_stdin_file@plt>
lea    0xe69(%rip),%rdi
call   1040 <ft_file_to_str@plt>
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11cd <main+0x8d>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <ft_file_to_str@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11e9 <main+0xa9>
lea    0xe26(%rip),%rdi
call   1060 <ft_puterr@plt>
jmp    11f2 <main+0xb2>
mov    -0x18(%rbp),%rdi
call   1050 <ft_handle_bsq@plt>
jmp    1173 <main+0x33>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
cmp    $0x1,%edi
setne  %al
cmp    %edi,%eax
jge    11bf <main+0x7f>
mov    %rsi,%r15
mov    %edi,%ebp
xor    %ebx,%ebx
cmp    $0x1,%edi
setne  %bl
mov    %edi,%r12d
lea    0xe92(%rip),%r13
lea    0xe90(%rip),%r14
jmp    118d <main+0x4d>
nopw   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1050 <ft_handle_bsq@plt>
cmp    %rbx,%r12
je     11bf <main+0x7f>
cmp    $0x1,%ebp
jne    11a0 <main+0x60>
xor    %eax,%eax
call   1030 <ft_stdin_file@plt>
mov    %r13,%rdi
jmp    11a4 <main+0x64>
xchg   %ax,%ax
mov    (%r15,%rbx,8),%rdi
call   1040 <ft_file_to_str@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1180 <main+0x40>
mov    %r14,%rdi
call   1060 <ft_puterr@plt>
cmp    %rbx,%r12
jne    118d <main+0x4d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"temp\00"
@.str.1 = [11 x i8] c"map error\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %7
br label %11
11: ; preds = %10, %2
br label %12
12: ; preds = %40, %11
%13 = load i32, i32* %7
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %41
16: ; preds = %12
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = call i32 (...) @ft_stdin_file()
%21 = call i8* @ft_file_to_str(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %21, i8** %6
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
store i32 %23, i32* %7
br label %32
24: ; preds = %16
%25 = load i8**, i8*** %5
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
%28 = sext i32 %26 to i64
%29 = getelementptr inbounds i8*, i8** %25, i64 %28
%30 = load i8*, i8** %29
%31 = call i8* @ft_file_to_str(i8* %30)
store i8* %31, i8** %6
br label %32
32: ; preds = %24, %19
%33 = load i8*, i8** %6
%34 = icmp ne i8* %33, null
br i1 %34, label %37, label %35
35: ; preds = %32
%36 = call i32 @ft_puterr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %40
37: ; preds = %32
%38 = load i8*, i8** %6
%39 = call i32 @ft_handle_bsq(i8* %38)
br label %40
40: ; preds = %37, %35
br label %12
41: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"temp\00"
@.str.1 = [11 x i8] c"map error\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp ne i32 %0, 1
%4 = zext i1 %3 to i32
%5 = icmp slt i32 %4, %0
br i1 %5, label %6, label %28
6: ; preds = %2
%7 = icmp eq i32 %0, 1
%8 = zext i1 %3 to i64
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %6, %26
%11 = phi i64 [ %8, %6 ], [ %20, %26 ]
br i1 %7, label %12, label %14
12: ; preds = %10
%13 = tail call i32 (...) @ft_stdin_file()
br label %17
14: ; preds = %10
%15 = getelementptr inbounds i8*, i8** %1, i64 %11
%16 = load i8*, i8** %15
br label %17
17: ; preds = %14, %12
%18 = phi i8* [ %16, %14 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %12 ]
%19 = tail call i8* @ft_file_to_str(i8* %18)
%20 = add nuw nsw i64 %11, 1
%21 = icmp eq i8* %19, null
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = tail call i32 @ft_puterr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %26
24: ; preds = %17
%25 = tail call i32 @ft_handle_bsq(i8* %19)
br label %26
26: ; preds = %24, %22
%27 = icmp eq i64 %20, %9
br i1 %27, label %28, label %10
28: ; preds = %26, %2
ret i32 0
}