#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 /*<<< orphan*/ copyStringLib(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
char *read();
int /*<<< orphan*/ readFile(char *);
int main(int argc, char **argv) {
  if (argc == 2) {
    readFile(argv[1]);
    return 0;
  } else {
    char *ourWord = read();
    int i;
    for (i = 0; i < 20; i++) {
      printf("%c", ourWord[i]);
    }
    printf("\n");
    char copied[20];
    copyStringLib(copied, ourWord);
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1179 <main+0x39>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <readFile@plt>
movl   $0x0,-0x4(%rbp)
jmp    11df <main+0x9f>
mov    $0x0,%al
call   1040 <read@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x14,-0x1c(%rbp)
jge    11bd <main+0x7d>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118b <main+0x4b>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <copyStringLib@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
cmp    $0x2,%edi
jne    1158 <main+0x18>
mov    0x8(%rsi),%rdi
call   1060 <readFile@plt>
jmp    122a <main+0xea>
xor    %eax,%eax
call   1040 <read@plt>
mov    %rax,%rbx
movsbl (%rax),%edi
call   1030 <putchar@plt>
movsbl 0x1(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x2(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x3(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x4(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x5(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x6(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x7(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x8(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x9(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0xa(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0xb(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0xc(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0xd(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0xe(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0xf(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x10(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x11(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x12(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x13(%rbx),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1050 <copyStringLib@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [20 x i8]
%4 = icmp eq i32 %0, 2
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @readFile(i8* %7)
br label %93
9: ; preds = %2
%10 = tail call i8* (...) @read()
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = tail call i32 @putchar(i32 %12)
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = tail call i32 @putchar(i32 %16)
%18 = getelementptr inbounds i8, i8* %10, i64 2
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = tail call i32 @putchar(i32 %20)
%22 = getelementptr inbounds i8, i8* %10, i64 3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = tail call i32 @putchar(i32 %24)
%26 = getelementptr inbounds i8, i8* %10, i64 4
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = tail call i32 @putchar(i32 %28)
%30 = getelementptr inbounds i8, i8* %10, i64 5
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = tail call i32 @putchar(i32 %32)
%34 = getelementptr inbounds i8, i8* %10, i64 6
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = tail call i32 @putchar(i32 %36)
%38 = getelementptr inbounds i8, i8* %10, i64 7
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = tail call i32 @putchar(i32 %40)
%42 = getelementptr inbounds i8, i8* %10, i64 8
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = tail call i32 @putchar(i32 %44)
%46 = getelementptr inbounds i8, i8* %10, i64 9
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = tail call i32 @putchar(i32 %48)
%50 = getelementptr inbounds i8, i8* %10, i64 10
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = tail call i32 @putchar(i32 %52)
%54 = getelementptr inbounds i8, i8* %10, i64 11
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = tail call i32 @putchar(i32 %56)
%58 = getelementptr inbounds i8, i8* %10, i64 12
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = tail call i32 @putchar(i32 %60)
%62 = getelementptr inbounds i8, i8* %10, i64 13
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = tail call i32 @putchar(i32 %64)
%66 = getelementptr inbounds i8, i8* %10, i64 14
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = tail call i32 @putchar(i32 %68)
%70 = getelementptr inbounds i8, i8* %10, i64 15
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = tail call i32 @putchar(i32 %72)
%74 = getelementptr inbounds i8, i8* %10, i64 16
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = tail call i32 @putchar(i32 %76)
%78 = getelementptr inbounds i8, i8* %10, i64 17
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = tail call i32 @putchar(i32 %80)
%82 = getelementptr inbounds i8, i8* %10, i64 18
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = tail call i32 @putchar(i32 %84)
%86 = getelementptr inbounds i8, i8* %10, i64 19
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = tail call i32 @putchar(i32 %88)
%90 = tail call i32 @putchar(i32 10)
%91 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%92 = call i32 @copyStringLib(i8* %91, i8* %10)
br label %93
93: ; preds = %9, %5
ret i32 0
}