#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 EXIT_FAILURE;
scalar_t__ EXIT_SUCCESS;
int /*<<< orphan*/ printErr(char *);
scalar_t__ strcmp(char *, char *);
int parseArgv(int argc, char *argv[], bool *modeHelp, bool *modeTest,
              bool *modeHline, bool *modeVline, bool *modeSquare,
              char **fileName) {
  for (int i = 1; i < argc; i++) {
    if (strcmp(argv[i], "--help") == EXIT_SUCCESS ||
        strcmp(argv[i], "-h") == EXIT_SUCCESS) {
      *modeHelp = true;
      return EXIT_SUCCESS;
    }
  }
  if (argc != 3) {
    printErr("Nespravny pocet agrumentu.");
    return EXIT_FAILURE;
  }
  *fileName = argv[2];
  if (strcmp(argv[1], "--test") == EXIT_SUCCESS) {
    *modeTest = true;
  } else if (strcmp(argv[1], "--hline") == EXIT_SUCCESS) {
    *modeHline = true;
  } else if (strcmp(argv[1], "--vline") == EXIT_SUCCESS) {
    *modeVline = true;
  } else if (strcmp(argv[1], "--square") == EXIT_SUCCESS) {
    *modeSquare = true;
  } else {
    printErr("Neznama volba.");
    return EXIT_FAILURE;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<parseArgv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d9 <parseArgv+0xb9>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe93(%rip),%rsi
call   1040 <strcmp@plt>
mov    0x2e5f(%rip),%rcx
cmp    (%rcx),%rax
je     11aa <parseArgv+0x8a>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe72(%rip),%rsi
call   1040 <strcmp@plt>
mov    0x2e37(%rip),%rcx
cmp    (%rcx),%rax
jne    11c6 <parseArgv+0xa6>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    0x2e1d(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x4(%rbp)
jmp    1314 <parseArgv+0x1f4>
jmp    11cb <parseArgv+0xab>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    114e <parseArgv+0x2e>
cmpl   $0x3,-0x8(%rbp)
je     1200 <parseArgv+0xe0>
lea    0xe20(%rip),%rdi
call   1030 <printErr@plt>
mov    0x2dea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1314 <parseArgv+0x1f4>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
mov    0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe07(%rip),%rsi
call   1040 <strcmp@plt>
mov    0x2dae(%rip),%rcx
cmp    (%rcx),%rax
jne    1242 <parseArgv+0x122>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
jmp    1307 <parseArgv+0x1e7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xddb(%rip),%rsi
call   1040 <strcmp@plt>
mov    0x2d7b(%rip),%rcx
cmp    (%rcx),%rax
jne    1275 <parseArgv+0x155>
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    1302 <parseArgv+0x1e2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdb0(%rip),%rsi
call   1040 <strcmp@plt>
mov    0x2d48(%rip),%rcx
cmp    (%rcx),%rax
jne    12a8 <parseArgv+0x188>
mov    -0x30(%rbp),%rax
movl   $0x1,(%rax)
jmp    12fd <parseArgv+0x1dd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd85(%rip),%rsi
call   1040 <strcmp@plt>
mov    0x2d15(%rip),%rcx
cmp    (%rcx),%rax
jne    12db <parseArgv+0x1bb>
mov    0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    12f8 <parseArgv+0x1d8>
lea    0xd63(%rip),%rdi
call   1030 <printErr@plt>
mov    0x2cf2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1314 <parseArgv+0x1f4>
jmp    12fd <parseArgv+0x1dd>
jmp    1302 <parseArgv+0x1e2>
jmp    1307 <parseArgv+0x1e7>
mov    0x2cca(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseArgv>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
cmp    $0x2,%edi
jl     122d <parseArgv+0x10d>
mov    %rsi,%rbx
mov    %rdx,0x8(%rsp)
mov    %r8,0x10(%rsp)
mov    %rcx,0x18(%rsp)
mov    %r9,0x20(%rsp)
mov    %edi,0x4(%rsp)
mov    %edi,%r13d
mov    $0x1,%ebp
lea    0xe9f(%rip),%r14
mov    0x2e70(%rip),%r15
lea    0xe98(%rip),%r12
nop
mov    (%rbx,%rbp,8),%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
cmp    (%r15),%rax
je     1244 <parseArgv+0x124>
mov    (%rbx,%rbp,8),%rdi
mov    %r12,%rsi
call   1040 <strcmp@plt>
cmp    (%r15),%rax
je     1244 <parseArgv+0x124>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1170 <parseArgv+0x50>
cmpl   $0x3,0x4(%rsp)
mov    0x20(%rsp),%r14
mov    0x18(%rsp),%rbp
mov    0x10(%rsp),%r12
jne    122d <parseArgv+0x10d>
mov    0x10(%rbx),%rax
mov    0x68(%rsp),%rcx
mov    %rax,(%rcx)
mov    0x8(%rbx),%rdi
lea    0xe55(%rip),%rsi
call   1040 <strcmp@plt>
cmp    (%r15),%rax
je     1224 <parseArgv+0x104>
mov    0x8(%rbx),%rdi
lea    0xe47(%rip),%rsi
call   1040 <strcmp@plt>
mov    %r12,%rbp
cmp    (%r15),%rax
je     1224 <parseArgv+0x104>
mov    0x8(%rbx),%rdi
lea    0xe37(%rip),%rsi
call   1040 <strcmp@plt>
mov    %r14,%rbp
cmp    (%r15),%rax
je     1224 <parseArgv+0x104>
mov    0x8(%rbx),%rdi
lea    0xe27(%rip),%rsi
call   1040 <strcmp@plt>
mov    0x60(%rsp),%rbp
cmp    (%r15),%rax
jne    125e <parseArgv+0x13e>
movl   $0x1,0x0(%rbp)
jmp    124f <parseArgv+0x12f>
lea    0xdd6(%rip),%rdi
call   1030 <printErr@plt>
mov    0x2da0(%rip),%rax
mov    (%rax),%eax
jmp    124f <parseArgv+0x12f>
mov    0x8(%rsp),%rcx
movl   $0x1,(%rcx)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xde0(%rip),%rdi
jmp    1234 <parseArgv+0x114>

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@EXIT_SUCCESS = global i64 0
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [27 x i8] c"Nespravny pocet agrumentu.\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [7 x i8] c"--test\00"
@.str.4 = [8 x i8] c"--hline\00"
@.str.5 = [8 x i8] c"--vline\00"
@.str.6 = [9 x i8] c"--square\00"
@.str.7 = [15 x i8] c"Neznama volba.\00"
define i32 @parseArgv(i32 %0, i8** %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i8** %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8**
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i8**
%18 = alloca i32
store i32 %0, i32* %10
store i8** %1, i8*** %11
store i32* %2, i32** %12
store i32* %3, i32** %13
store i32* %4, i32** %14
store i32* %5, i32** %15
store i32* %6, i32** %16
store i8** %7, i8*** %17
store i32 1, i32* %18
br label %19
19: ; preds = %46, %8
%20 = load i32, i32* %18
%21 = load i32, i32* %10
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %49
23: ; preds = %19
%24 = load i8**, i8*** %11
%25 = load i32, i32* %18
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%30 = load i64, i64* @EXIT_SUCCESS
%31 = icmp eq i64 %29, %30
br i1 %31, label %41, label %32
32: ; preds = %23
%33 = load i8**, i8*** %11
%34 = load i32, i32* %18
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %33, i64 %35
%37 = load i8*, i8** %36
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%39 = load i64, i64* @EXIT_SUCCESS
%40 = icmp eq i64 %38, %39
br i1 %40, label %41, label %45
41: ; preds = %32, %23
%42 = load i32*, i32** %12
store i32 1, i32* %42
%43 = load i64, i64* @EXIT_SUCCESS
%44 = trunc i64 %43 to i32
store i32 %44, i32* %9
br label %104
45: ; preds = %32
br label %46
46: ; preds = %45
%47 = load i32, i32* %18
%48 = add nsw i32 %47, 1
store i32 %48, i32* %18
br label %19
49: ; preds = %19
%50 = load i32, i32* %10
%51 = icmp ne i32 %50, 3
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = call i32 @printErr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%54 = load i32, i32* @EXIT_FAILURE
store i32 %54, i32* %9
br label %104
55: ; preds = %49
%56 = load i8**, i8*** %11
%57 = getelementptr inbounds i8*, i8** %56, i64 2
%58 = load i8*, i8** %57
%59 = load i8**, i8*** %17
store i8* %58, i8** %59
%60 = load i8**, i8*** %11
%61 = getelementptr inbounds i8*, i8** %60, i64 1
%62 = load i8*, i8** %61
%63 = call i64 @strcmp(i8* %62, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%64 = load i64, i64* @EXIT_SUCCESS
%65 = icmp eq i64 %63, %64
br i1 %65, label %66, label %68
66: ; preds = %55
%67 = load i32*, i32** %13
store i32 1, i32* %67
br label %101
68: ; preds = %55
%69 = load i8**, i8*** %11
%70 = getelementptr inbounds i8*, i8** %69, i64 1
%71 = load i8*, i8** %70
%72 = call i64 @strcmp(i8* %71, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%73 = load i64, i64* @EXIT_SUCCESS
%74 = icmp eq i64 %72, %73
br i1 %74, label %75, label %77
75: ; preds = %68
%76 = load i32*, i32** %14
store i32 1, i32* %76
br label %100
77: ; preds = %68
%78 = load i8**, i8*** %11
%79 = getelementptr inbounds i8*, i8** %78, i64 1
%80 = load i8*, i8** %79
%81 = call i64 @strcmp(i8* %80, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%82 = load i64, i64* @EXIT_SUCCESS
%83 = icmp eq i64 %81, %82
br i1 %83, label %84, label %86
84: ; preds = %77
%85 = load i32*, i32** %15
store i32 1, i32* %85
br label %99
86: ; preds = %77
%87 = load i8**, i8*** %11
%88 = getelementptr inbounds i8*, i8** %87, i64 1
%89 = load i8*, i8** %88
%90 = call i64 @strcmp(i8* %89, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%91 = load i64, i64* @EXIT_SUCCESS
%92 = icmp eq i64 %90, %91
br i1 %92, label %93, label %95
93: ; preds = %86
%94 = load i32*, i32** %16
store i32 1, i32* %94
br label %98
95: ; preds = %86
%96 = call i32 @printErr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%97 = load i32, i32* @EXIT_FAILURE
store i32 %97, i32* %9
br label %104
98: ; preds = %93
br label %99
99: ; preds = %98, %84
br label %100
100: ; preds = %99, %75
br label %101
101: ; preds = %100, %66
%102 = load i64, i64* @EXIT_SUCCESS
%103 = trunc i64 %102 to i32
store i32 %103, i32* %9
br label %104
104: ; preds = %101, %95, %52, %41
%105 = load i32, i32* %9
ret i32 %105
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@EXIT_SUCCESS = global i64 0
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [27 x i8] c"Nespravny pocet agrumentu.\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [7 x i8] c"--test\00"
@.str.4 = [8 x i8] c"--hline\00"
@.str.5 = [8 x i8] c"--vline\00"
@.str.6 = [9 x i8] c"--square\00"
@.str.7 = [15 x i8] c"Neznama volba.\00"
define i32 @parseArgv(i32 %0, i8** nocapture %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6, i8** nocapture writeonly %7) {
%9 = icmp sgt i32 %0, 1
br i1 %9, label %10, label %32
10: ; preds = %8
%11 = zext i32 %0 to i64
br label %14
12: ; preds = %21
%13 = icmp eq i64 %26, %11
br i1 %13, label %30, label %14
14: ; preds = %10, %12
%15 = phi i64 [ 1, %10 ], [ %26, %12 ]
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%19 = load i64, i64* @EXIT_SUCCESS
%20 = icmp eq i64 %18, %19
br i1 %20, label %27, label %21
21: ; preds = %14
%22 = load i8*, i8** %16
%23 = tail call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%24 = load i64, i64* @EXIT_SUCCESS
%25 = icmp eq i64 %23, %24
%26 = add nuw nsw i64 %15, 1
br i1 %25, label %27, label %12
27: ; preds = %14, %21
%28 = phi i64 [ %18, %14 ], [ %23, %21 ]
store i32 1, i32* %2
%29 = trunc i64 %28 to i32
br label %65
30: ; preds = %12
%31 = icmp eq i32 %0, 3
br i1 %31, label %35, label %32
32: ; preds = %8, %30
%33 = tail call i32 @printErr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%34 = load i32, i32* @EXIT_FAILURE
br label %65
35: ; preds = %30
%36 = getelementptr inbounds i8*, i8** %1, i64 2
%37 = load i8*, i8** %36
store i8* %37, i8** %7
%38 = getelementptr inbounds i8*, i8** %1, i64 1
%39 = load i8*, i8** %38
%40 = tail call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%41 = load i64, i64* @EXIT_SUCCESS
%42 = icmp eq i64 %40, %41
br i1 %42, label %61, label %43
43: ; preds = %35
%44 = load i8*, i8** %38
%45 = tail call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%46 = load i64, i64* @EXIT_SUCCESS
%47 = icmp eq i64 %45, %46
br i1 %47, label %61, label %48
48: ; preds = %43
%49 = load i8*, i8** %38
%50 = tail call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%51 = load i64, i64* @EXIT_SUCCESS
%52 = icmp eq i64 %50, %51
br i1 %52, label %61, label %53
53: ; preds = %48
%54 = load i8*, i8** %38
%55 = tail call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%56 = load i64, i64* @EXIT_SUCCESS
%57 = icmp eq i64 %55, %56
br i1 %57, label %61, label %58
58: ; preds = %53
%59 = tail call i32 @printErr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%60 = load i32, i32* @EXIT_FAILURE
br label %65
61: ; preds = %53, %48, %43, %35
%62 = phi i32* [ %3, %35 ], [ %4, %43 ], [ %5, %48 ], [ %6, %53 ]
%63 = phi i64 [ %40, %35 ], [ %45, %43 ], [ %50, %48 ], [ %55, %53 ]
store i32 1, i32* %62
%64 = trunc i64 %63 to i32
br label %65
65: ; preds = %27, %61, %58, %32
%66 = phi i32 [ %29, %27 ], [ %34, %32 ], [ %64, %61 ], [ %60, %58 ]
ret i32 %66
}