#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void handler(const int derp) {
  if (derp == 0) {
    printf("usage - /PathToFile(if using command) RAMLimitInBytes "
           "Command(optional)\n");
    printf("-help to show this message\n");
    printf("-commands to show commands and their parameters\n");
  } else if (derp == 1) {
    printf("incorrect command\n");
    printf("availible ones:\n");
    printf("-stats\n");
    printf("-print From To\n");
    printf("-search SubString(special symbols can be included only with slash "
           "and correspoding symbol (i.e. /n for new line))\n");
    printf("-add string AtBytePos\n");
    printf("-remove AtBytePos NumOfSym\n");
  } else if (derp == 2) {
    printf("availible commands:\n");
    printf("-stats\n");
    printf("-print From To\n");
    printf("-search SubString(special symbols can be included only with slash "
           "and correspoding symbol (i.e. /n for new line))\n");
    printf("-add string AtBytePos\n");
    printf("-remove AtBytePos NumOfSym\n");
  }
  exit(0);
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    115e <handler+0x3e>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
lea    0xf01(%rip),%rdi
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
call   1030 <printf@plt>
jmp    121d <handler+0xfd>
cmpl   $0x1,-0x4(%rbp)
jne    11c1 <handler+0xa1>
lea    0xf27(%rip),%rdi
call   1030 <printf@plt>
lea    0xf2e(%rip),%rdi
call   1030 <printf@plt>
lea    0xf33(%rip),%rdi
call   1030 <printf@plt>
lea    0xf2f(%rip),%rdi
call   1030 <printf@plt>
lea    0xf33(%rip),%rdi
call   1030 <printf@plt>
lea    0xf9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xfa5(%rip),%rdi
call   1030 <printf@plt>
jmp    1218 <handler+0xf8>
cmpl   $0x2,-0x4(%rbp)
jne    1213 <handler+0xf3>
lea    0xfa6(%rip),%rdi
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
lea    0xf43(%rip),%rdi
call   1030 <printf@plt>
lea    0xf4e(%rip),%rdi
call   1030 <printf@plt>
jmp    1218 <handler+0xf8>
jmp    121d <handler+0xfd>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<handler>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
je     1147 <handler+0x27>
cmp    $0x2,%edi
je     115e <handler+0x3e>
cmp    $0x1,%edi
jne    11ac <handler+0x8c>
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xee1(%rip),%rdi
jmp    1165 <handler+0x45>
lea    0x1004(%rip),%r14
lea    0xfe2(%rip),%rbx
lea    0xf93(%rip),%rdi
jmp    1197 <handler+0x77>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
lea    0xf4b(%rip),%r14
lea    0xf2e(%rip),%rbx
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [73 x i8] c"usage - /PathToFile(if using command) RAMLimitInBytes Command(optional)\0A\00"
@.str.1 = [28 x i8] c"-help to show this message\0A\00"
@.str.2 = [49 x i8] c"-commands to show commands and their parameters\0A\00"
@.str.3 = [19 x i8] c"incorrect command\0A\00"
@.str.4 = [17 x i8] c"availible ones:\0A\00"
@.str.5 = [8 x i8] c"-stats\0A\00"
@.str.6 = [16 x i8] c"-print From To\0A\00"
@.str.7 = [115 x i8] c"-search SubString(special symbols can be included only with slash and correspoding symbol (i.e. /n for new line))\0A\00"
@.str.8 = [23 x i8] c"-add string AtBytePos\0A\00"
@.str.9 = [28 x i8] c"-remove AtBytePos NumOfSym\0A\00"
@.str.10 = [21 x i8] c"availible commands:\0A\00"
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
br label %32
9: ; preds = %1
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %31
20: ; preds = %9
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %30
23: ; preds = %20
%24 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0))
%25 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%26 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str.7, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%29 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %30
30: ; preds = %23, %20
br label %31
31: ; preds = %30, %12
br label %32
32: ; preds = %31, %5
%33 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [20 x i8] c"availible commands:\00"
@str.16 = [18 x i8] c"incorrect command\00"
@str.17 = [16 x i8] c"availible ones:\00"
@str.18 = [7 x i8] c"-stats\00"
@str.19 = [15 x i8] c"-print From To\00"
@str.20 = [114 x i8] c"-search SubString(special symbols can be included only with slash and correspoding symbol (i.e. /n for new line))\00"
@str.21 = [22 x i8] c"-add string AtBytePos\00"
@str.22 = [27 x i8] c"-remove AtBytePos NumOfSym\00"
@str.23 = [72 x i8] c"usage - /PathToFile(if using command) RAMLimitInBytes Command(optional)\00"
@str.24 = [27 x i8] c"-help to show this message\00"
@str.25 = [48 x i8] c"-commands to show commands and their parameters\00"
define void @handler(i32 %0) {
switch i32 %0, label %21 [
i32 0, label %14
i32 1, label %2
i32 2, label %4
]
2: ; preds = %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.16, i64 0, i64 0))
br label %4
4: ; preds = %1, %2
%5 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.17, i64 0, i64 0), %2 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0), %1 ]
%6 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.18, i64 0, i64 0), %2 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.18, i64 0, i64 0), %1 ]
%7 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.19, i64 0, i64 0), %2 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.19, i64 0, i64 0), %1 ]
%8 = phi i8* [ getelementptr inbounds ([114 x i8], [114 x i8]* @str.20, i64 0, i64 0), %2 ], [ getelementptr inbounds ([114 x i8], [114 x i8]* @str.20, i64 0, i64 0), %1 ]
%9 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.21, i64 0, i64 0), %2 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.21, i64 0, i64 0), %1 ]
%10 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @str.22, i64 0, i64 0), %2 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @str.22, i64 0, i64 0), %1 ]
%11 = tail call i32 @puts(i8* dereferenceable(1) %5)
%12 = tail call i32 @puts(i8* dereferenceable(1) %6)
%13 = tail call i32 @puts(i8* dereferenceable(1) %7)
br label %14
14: ; preds = %4, %1
%15 = phi i8* [ getelementptr inbounds ([72 x i8], [72 x i8]* @str.23, i64 0, i64 0), %1 ], [ %8, %4 ]
%16 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @str.24, i64 0, i64 0), %1 ], [ %9, %4 ]
%17 = phi i8* [ getelementptr inbounds ([48 x i8], [48 x i8]* @str.25, i64 0, i64 0), %1 ], [ %10, %4 ]
%18 = tail call i32 @puts(i8* dereferenceable(1) %15)
%19 = tail call i32 @puts(i8* dereferenceable(1) %16)
%20 = tail call i32 @puts(i8* dereferenceable(1) %17)
br label %21
21: ; preds = %14, %1
%22 = tail call i32 @exit(i32 0)
unreachable
}