#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ fdividebyline(char *, int /*<<< orphan*/);
int /*<<< orphan*/ parseint(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ printhelp();
int /*<<< orphan*/ puts(char *);
scalar_t__ stringmatch(char *, char *);
scalar_t__ strlen(char *);
int main(int argc, char **argv) {
  uint8_t count;
  printf("[+] Executing DicDivider with (%u) arguments: ", argc - 1);
  for (count = 1; count < argc && count < 256; count++) {
    printf("%s[%d]  ", argv[count], (int)strlen(argv[count]));
  }
  puts("");
  if (argc == 2 &&
      (stringmatch(argv[1], "-h") || stringmatch(argv[1], "--help"))) {
    puts("\n ->> [+] I think you need help, let's do something about it...\n");
    printhelp();
  } else if (argc == 4) {
    if (stringmatch(argv[1], "-l") || stringmatch(argv[1], "--line")) {
      printf("[+] Preparing to divide %s in files of %s lines each...\n",
             argv[3], argv[2]);
      fdividebyline(argv[3], parseint(argv[2]));
    } else {
      printf("[!] Wrong options? Check \"dicdivider -- help\" for help\n");
    }
  } else {
    printf("\n[!] I need more/different arguments. See \"dicdivider --help\" "
           "for help\n");
  }
  puts(" ");
  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)
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x15(%rbp)
jge    11bf <main+0x4f>
cmpl   $0x100,-0x14(%rbp)
setl   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    11cf <main+0x5f>
jmp    1212 <main+0xa2>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <strlen@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a1 <main+0x31>
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x2,-0x8(%rbp)
jne    127c <main+0x10c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe01(%rip),%rsi
call   1080 <stringmatch@plt>
cmp    $0x0,%rax
jne    1264 <main+0xf4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xde6(%rip),%rsi
call   1080 <stringmatch@plt>
cmp    $0x0,%rax
je     127c <main+0x10c>
lea    0xdd7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1070 <printhelp@plt>
jmp    132f <main+0x1bf>
cmpl   $0x4,-0x8(%rbp)
jne    131c <main+0x1ac>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdee(%rip),%rsi
call   1080 <stringmatch@plt>
cmp    $0x0,%rax
jne    12c2 <main+0x152>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdd3(%rip),%rsi
call   1080 <stringmatch@plt>
cmp    $0x0,%rax
je     1309 <main+0x199>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <parseint@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1090 <fdividebyline@plt>
jmp    1317 <main+0x1a7>
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    132a <main+0x1ba>
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    132f <main+0x1bf>
lea    0xd00(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%r14d
lea    -0x1(%r14),%esi
lea    0xe64(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
cmp    $0x2,%r14d
jl     11f5 <main+0x75>
lea    -0x2(%r14),%eax
cmp    $0xfe,%eax
mov    $0xfe,%r13d
cmovb  %eax,%r13d
add    $0x1,%r13
lea    0xe68(%rip),%r12
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    0x8(%r15,%rbp,8),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    11d0 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x4,%r14d
je     1258 <main+0xd8>
cmp    $0x2,%r14d
jne    124a <main+0xca>
mov    0x8(%r15),%rdi
lea    0xe22(%rip),%rsi
call   1090 <stringmatch@plt>
test   %rax,%rax
jne    1235 <main+0xb5>
mov    0x8(%r15),%rdi
lea    0xe10(%rip),%rsi
call   1090 <stringmatch@plt>
test   %rax,%rax
je     124a <main+0xca>
lea    0xe06(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1080 <printhelp@plt>
jmp    12af <main+0x12f>
lea    0xe75(%rip),%rdi
call   1040 <puts@plt>
jmp    12af <main+0x12f>
mov    0x8(%r15),%rdi
lea    0xe20(%rip),%rsi
call   1090 <stringmatch@plt>
test   %rax,%rax
jne    1282 <main+0x102>
mov    0x8(%r15),%rdi
lea    0xe0e(%rip),%rsi
call   1090 <stringmatch@plt>
test   %rax,%rax
je     12cc <main+0x14c>
mov    0x10(%r15),%rdx
mov    0x18(%r15),%rsi
lea    0xdfc(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x10(%r15),%rdi
mov    0x18(%r15),%rbx
call   1050 <parseint@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   10a0 <fdividebyline@plt>
lea    0xd80(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe3a(%rip),%rdi
jmp    1251 <main+0xd1>

LLVM IR (-O0):
@.str = [47 x i8] c"[+] Executing DicDivider with (%u) arguments: \00"
@.str.1 = [9 x i8] c"%s[%d] \00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [3 x i8] c"-h\00"
@.str.4 = [7 x i8] c"--help\00"
@.str.5 = [65 x i8] c"\0A ->> [+] I think you need help, let's do something about it...\0A\00"
@.str.6 = [3 x i8] c"-l\00"
@.str.7 = [7 x i8] c"--line\00"
@.str.8 = [57 x i8] c"[+] Preparing to divide %s in files of %s lines each...\0A\00"
@.str.9 = [56 x i8] c"[!] Wrong options? Check \22dicdivider -- help\22 for help\0A\00"
@.str.10 = [72 x i8] c"\0A[!] I need more/different arguments. See \22dicdivider --help\22 for help\0A\00"
@.str.11 = [2 x i8] c" \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = sub nsw i32 %7, 1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %8)
store i32 1, i32* %6
br label %10
10: ; preds = %33, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 256
br label %17
17: ; preds = %14, %10
%18 = phi i1 [ false, %10 ], [ %16, %14 ]
br i1 %18, label %19, label %36
19: ; preds = %17
%20 = load i8**, i8*** %5
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = load i8**, i8*** %5
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = call i64 @strlen(i8* %29)
%31 = trunc i64 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %24, i32 %31)
br label %33
33: ; preds = %19
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %10
36: ; preds = %17
%37 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, 2
br i1 %39, label %40, label %55
40: ; preds = %36
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i64 @stringmatch(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%45 = icmp ne i64 %44, 0
br i1 %45, label %52, label %46
46: ; preds = %40
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
%50 = call i64 @stringmatch(i8* %49, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %46, %40
%53 = call i32 @puts(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.5, i64 0, i64 0))
%54 = call i32 (...) @printhelp()
br label %92
55: ; preds = %46, %36
%56 = load i32, i32* %4
%57 = icmp eq i32 %56, 4
br i1 %57, label %58, label %89
58: ; preds = %55
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 1
%61 = load i8*, i8** %60
%62 = call i64 @stringmatch(i8* %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%63 = icmp ne i64 %62, 0
br i1 %63, label %70, label %64
64: ; preds = %58
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 1
%67 = load i8*, i8** %66
%68 = call i64 @stringmatch(i8* %67, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %86
70: ; preds = %64, %58
%71 = load i8**, i8*** %5
%72 = getelementptr inbounds i8*, i8** %71, i64 3
%73 = load i8*, i8** %72
%74 = load i8**, i8*** %5
%75 = getelementptr inbounds i8*, i8** %74, i64 2
%76 = load i8*, i8** %75
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0), i8* %73, i8* %76)
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 3
%80 = load i8*, i8** %79
%81 = load i8**, i8*** %5
%82 = getelementptr inbounds i8*, i8** %81, i64 2
%83 = load i8*, i8** %82
%84 = call i32 @parseint(i8* %83)
%85 = call i32 @fdividebyline(i8* %80, i32 %84)
br label %88
86: ; preds = %64
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.9, i64 0, i64 0))
br label %88
88: ; preds = %86, %70
br label %91
89: ; preds = %55
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.10, i64 0, i64 0))
br label %91
91: ; preds = %89, %88
br label %92
92: ; preds = %91, %52
%93 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"[+] Executing DicDivider with (%u) arguments: \00"
@.str.1 = [9 x i8] c"%s[%d] \00"
@.str.3 = [3 x i8] c"-h\00"
@.str.4 = [7 x i8] c"--help\00"
@.str.5 = [65 x i8] c"\0A ->> [+] I think you need help, let's do something about it...\0A\00"
@.str.6 = [3 x i8] c"-l\00"
@.str.7 = [7 x i8] c"--line\00"
@.str.8 = [57 x i8] c"[+] Preparing to divide %s in files of %s lines each...\0A\00"
@.str.11 = [2 x i8] c" \00"
@str = [71 x i8] c"\0A[!] I need more/different arguments. See \22dicdivider --help\22 for help\00"
@str.12 = [55 x i8] c"[!] Wrong options? Check \22dicdivider -- help\22 for help\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add nsw i32 %0, -1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %20
6: ; preds = %2
%7 = add nsw i32 %0, -2
%8 = call i32 @llvm.umin.i32(i32 %7, i32 254)
%9 = add nuw nsw i32 %8, 2
%10 = zext i32 %9 to i64
br label %11
11: ; preds = %6, %11
%12 = phi i64 [ 1, %6 ], [ %18, %11 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i64 @strlen(i8* dereferenceable(1) %14)
%16 = trunc i64 %15 to i32
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %14, i32 %16)
%18 = add nuw nsw i64 %12, 1
%19 = icmp eq i64 %18, %10
br i1 %19, label %20, label %11
20: ; preds = %11, %2
%21 = tail call i32 @putchar(i32 10)
switch i32 %0, label %55 [
i32 2, label %22
i32 4, label %34
]
22: ; preds = %20
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = tail call i64 @stringmatch(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %22
%28 = load i8*, i8** %23
%29 = tail call i64 @stringmatch(i8* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %55, label %31
31: ; preds = %27, %22
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.5, i64 0, i64 0))
%33 = tail call i32 (...) @printhelp()
br label %57
34: ; preds = %20
%35 = getelementptr inbounds i8*, i8** %1, i64 1
%36 = load i8*, i8** %35
%37 = tail call i64 @stringmatch(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %34
%40 = load i8*, i8** %35
%41 = tail call i64 @stringmatch(i8* %40, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %53, label %43
43: ; preds = %39, %34
%44 = getelementptr inbounds i8*, i8** %1, i64 3
%45 = load i8*, i8** %44
%46 = getelementptr inbounds i8*, i8** %1, i64 2
%47 = load i8*, i8** %46
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0), i8* %45, i8* %47)
%49 = load i8*, i8** %44
%50 = load i8*, i8** %46
%51 = tail call i32 @parseint(i8* %50)
%52 = tail call i32 @fdividebyline(i8* %49, i32 %51)
br label %57
53: ; preds = %39
%54 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.12, i64 0, i64 0))
br label %57
55: ; preds = %27, %20
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str, i64 0, i64 0))
br label %57
57: ; preds = %55, %53, %43, %31
%58 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
ret i32 0
}