#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 *);
int /*<<< orphan*/ printHelp();
scalar_t__ strcmp(char *, char *);
int parseMode(int argc, char *argv[], bool *sqrt, bool *asin, bool *triangle) {
  if (argc == 1) {
    printErr("Nebyl zadan zadny argument...");
    return EXIT_FAILURE;
  }
  for (int i = 1; i < argc; i++) {
    if (strcmp(argv[i], "--help") == EXIT_SUCCESS ||
        strcmp(argv[i], "-h") == EXIT_SUCCESS) {
      printHelp();
      return EXIT_SUCCESS;
    }
  }
  if (strcmp(argv[1], "--sqrt") == EXIT_SUCCESS) {
    *sqrt = true;
  } else if (strcmp(argv[1], "--asin") == EXIT_SUCCESS) {
    *asin = true;
  } else if (strcmp(argv[1], "--triangle") == EXIT_SUCCESS) {
    *triangle = true;
  } else {
    printErr("Neznama volba!");
    return EXIT_FAILURE;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<parseMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1172 <parseMode+0x42>
lea    0xea4(%rip),%rdi
call   1040 <printErr@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12ce <parseMode+0x19e>
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1201 <parseMode+0xd1>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe86(%rip),%rsi
call   1050 <strcmp@plt>
mov    0x2e34(%rip),%rcx
cmp    (%rcx),%rax
je     11d5 <parseMode+0xa5>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe65(%rip),%rsi
call   1050 <strcmp@plt>
mov    0x2e0c(%rip),%rcx
cmp    (%rcx),%rax
jne    11ee <parseMode+0xbe>
mov    $0x0,%al
call   1030 <printHelp@plt>
mov    0x2df5(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x4(%rbp)
jmp    12ce <parseMode+0x19e>
jmp    11f3 <parseMode+0xc3>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1179 <parseMode+0x49>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe18(%rip),%rsi
call   1050 <strcmp@plt>
mov    0x2dbc(%rip),%rcx
cmp    (%rcx),%rax
jne    1234 <parseMode+0x104>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
jmp    12c1 <parseMode+0x191>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdec(%rip),%rsi
call   1050 <strcmp@plt>
mov    0x2d89(%rip),%rcx
cmp    (%rcx),%rax
jne    1267 <parseMode+0x137>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
jmp    12bc <parseMode+0x18c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdc0(%rip),%rsi
call   1050 <strcmp@plt>
mov    0x2d56(%rip),%rcx
cmp    (%rcx),%rax
jne    129a <parseMode+0x16a>
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    12b7 <parseMode+0x187>
lea    0xda0(%rip),%rdi
call   1040 <printErr@plt>
mov    0x2d33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12ce <parseMode+0x19e>
jmp    12bc <parseMode+0x18c>
jmp    12c1 <parseMode+0x191>
mov    0x2d10(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseMode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x1,%edi
jne    115d <parseMode+0x2d>
lea    0xeb6(%rip),%rdi
call   1040 <printErr@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%eax
jmp    1224 <parseMode+0xf4>
mov    %rsi,%rbx
mov    %rdx,0x10(%rsp)
mov    %rcx,0x8(%rsp)
mov    %r8,(%rsp)
jle    11bb <parseMode+0x8b>
mov    %edi,%r15d
mov    $0x1,%r12d
lea    0xe9e(%rip),%r13
mov    0x2e51(%rip),%r14
lea    0xe97(%rip),%rbp
xchg   %ax,%ax
mov    (%rbx,%r12,8),%rdi
mov    %r13,%rsi
call   1050 <strcmp@plt>
cmp    (%r14),%rax
je     121a <parseMode+0xea>
mov    (%rbx,%r12,8),%rdi
mov    %rbp,%rsi
call   1050 <strcmp@plt>
cmp    (%r14),%rax
je     121a <parseMode+0xea>
add    $0x1,%r12
cmp    %r12,%r15
jne    1190 <parseMode+0x60>
mov    0x8(%rbx),%rdi
lea    0xe62(%rip),%rsi
call   1050 <strcmp@plt>
mov    0x2e06(%rip),%rbp
cmp    0x0(%rbp),%rax
mov    0x10(%rsp),%rcx
je     1212 <parseMode+0xe2>
mov    0x8(%rbx),%rdi
lea    0xe47(%rip),%rsi
call   1050 <strcmp@plt>
mov    0x8(%rsp),%rcx
cmp    0x0(%rbp),%rax
je     1212 <parseMode+0xe2>
mov    0x8(%rbx),%rdi
lea    0xe33(%rip),%rsi
call   1050 <strcmp@plt>
mov    (%rsp),%rcx
cmp    0x0(%rbp),%rax
jne    1233 <parseMode+0x103>
movl   $0x1,(%rcx)
jmp    1224 <parseMode+0xf4>
xor    %eax,%eax
call   1030 <printHelp@plt>
mov    (%r14),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe07(%rip),%rdi
jmp    114a <parseMode+0x1a>

LLVM IR (-O0):
@.str = [30 x i8] c"Nebyl zadan zadny argument...\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [7 x i8] c"--help\00"
@EXIT_SUCCESS = global i64 0
@.str.2 = [3 x i8] c"-h\00"
@.str.3 = [7 x i8] c"--sqrt\00"
@.str.4 = [7 x i8] c"--asin\00"
@.str.5 = [11 x i8] c"--triangle\00"
@.str.6 = [15 x i8] c"Neznama volba!\00"
define i32 @parseMode(i32 %0, i8** %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32
store i32 %0, i32* %7
store i8** %1, i8*** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
%13 = load i32, i32* %7
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %5
%16 = call i32 @printErr(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
store i32 %17, i32* %6
br label %84
18: ; preds = %5
store i32 1, i32* %12
br label %19
19: ; preds = %46, %18
%20 = load i32, i32* %12
%21 = load i32, i32* %7
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %49
23: ; preds = %19
%24 = load i8**, i8*** %8
%25 = load i32, i32* %12
%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.1, 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*** %8
%34 = load i32, i32* %12
%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.2, 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 = call i32 (...) @printHelp()
%43 = load i64, i64* @EXIT_SUCCESS
%44 = trunc i64 %43 to i32
store i32 %44, i32* %6
br label %84
45: ; preds = %32
br label %46
46: ; preds = %45
%47 = load i32, i32* %12
%48 = add nsw i32 %47, 1
store i32 %48, i32* %12
br label %19
49: ; preds = %19
%50 = load i8**, i8*** %8
%51 = getelementptr inbounds i8*, i8** %50, i64 1
%52 = load i8*, i8** %51
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%54 = load i64, i64* @EXIT_SUCCESS
%55 = icmp eq i64 %53, %54
br i1 %55, label %56, label %58
56: ; preds = %49
%57 = load i32*, i32** %9
store i32 1, i32* %57
br label %81
58: ; preds = %49
%59 = load i8**, i8*** %8
%60 = getelementptr inbounds i8*, i8** %59, i64 1
%61 = load i8*, i8** %60
%62 = call i64 @strcmp(i8* %61, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%63 = load i64, i64* @EXIT_SUCCESS
%64 = icmp eq i64 %62, %63
br i1 %64, label %65, label %67
65: ; preds = %58
%66 = load i32*, i32** %10
store i32 1, i32* %66
br label %80
67: ; preds = %58
%68 = load i8**, i8*** %8
%69 = getelementptr inbounds i8*, i8** %68, i64 1
%70 = load i8*, i8** %69
%71 = call i64 @strcmp(i8* %70, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%72 = load i64, i64* @EXIT_SUCCESS
%73 = icmp eq i64 %71, %72
br i1 %73, label %74, label %76
74: ; preds = %67
%75 = load i32*, i32** %11
store i32 1, i32* %75
br label %79
76: ; preds = %67
%77 = call i32 @printErr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%78 = load i32, i32* @EXIT_FAILURE
store i32 %78, i32* %6
br label %84
79: ; preds = %74
br label %80
80: ; preds = %79, %65
br label %81
81: ; preds = %80, %56
%82 = load i64, i64* @EXIT_SUCCESS
%83 = trunc i64 %82 to i32
store i32 %83, i32* %6
br label %84
84: ; preds = %81, %76, %41, %15
%85 = load i32, i32* %6
ret i32 %85
}

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