#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 atoi(char *);
int atol(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ mergei(int, int, int, char *, char *, char *, int *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int DocIDcount = 0;
  if (argc == 7) {
    int startIndex = atoi(argv[1]);
    int stoppIndex = atoi(argv[2]) + 1;
    char *type = argv[3];
    char *lang = argv[4];
    char *subname = argv[5];
    int bucket = atol(argv[6]);
    mergei(bucket, startIndex, stoppIndex, type, lang, subname, &DocIDcount);
    printf("DocIDcount: %i\n", DocIDcount);
  } else if (argc == 6) {
    int i;
    int startIndex = atoi(argv[1]);
    int stoppIndex = atoi(argv[2]) + 1;
    char *type = argv[3];
    char *lang = argv[4];
    char *subname = argv[5];
    for (i = 0; i <= 63; i++) {
      mergei(i, startIndex, stoppIndex, type, lang, subname, &DocIDcount);
    }
    printf("DocIDcount: %i (/64)\n", DocIDcount);
  } else {
    printf("Dette programet printer ut en iindex.\n\n");
    printf("\tUse:\n\n\t./mergeIIndex fralot tillot type (Main | Anchor) språk "
           "subname [bucket]\n\n");
    exit(0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x7,-0x8(%rbp)
jne    1206 <main+0xb6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
call   1050 <atol@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
lea    -0x14(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <mergei@plt>
mov    -0x14(%rbp),%esi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d6 <main+0x186>
cmpl   $0x6,-0x8(%rbp)
jne    12ae <main+0x15e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x40(%rbp)
cmpl   $0x3f,-0x40(%rbp)
jg     1298 <main+0x148>
mov    -0x40(%rbp),%edi
mov    -0x44(%rbp),%esi
mov    -0x48(%rbp),%edx
mov    -0x50(%rbp),%rcx
mov    -0x58(%rbp),%r8
mov    -0x60(%rbp),%r9
lea    -0x14(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <mergei@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    125e <main+0x10e>
mov    -0x14(%rbp),%esi
lea    0xd6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d1 <main+0x181>
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
jmp    12d6 <main+0x186>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
movl   $0x0,0x14(%rsp)
cmp    $0x6,%edi
je     11df <main+0x7f>
cmp    $0x7,%edi
jne    125a <main+0xfa>
mov    0x8(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
call   1070 <atoi@plt>
lea    0x1(%rax),%ebp
mov    0x18(%rbx),%r15
mov    0x20(%rbx),%r12
mov    0x28(%rbx),%r13
mov    0x30(%rbx),%rdi
call   1060 <atol@plt>
lea    0x14(%rsp),%rcx
mov    %rcx,(%rsp)
mov    %eax,%edi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %r15,%rcx
mov    %r12,%r8
mov    %r13,%r9
call   1050 <mergei@plt>
mov    0x14(%rsp),%esi
lea    0xe23(%rip),%rdi
jmp    1242 <main+0xe2>
mov    0x8(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%r15d
mov    0x10(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%r13d
add    $0x1,%r13d
mov    0x18(%rbx),%r12
mov    0x20(%rbx),%r14
mov    0x28(%rbx),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
lea    0x14(%rsp),%rax
mov    %rax,(%rsp)
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r13d,%edx
mov    %r12,%rcx
mov    %r14,%r8
mov    %rbx,%r9
call   1050 <mergei@plt>
add    $0x1,%ebp
cmp    $0x40,%ebp
jne    1210 <main+0xb0>
mov    0x14(%rsp),%esi
lea    0xdce(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdc5(%rip),%rdi
call   1030 <puts@plt>
lea    0xde0(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"DocIDcount: %i\0A\00"
@.str.1 = [22 x i8] c"DocIDcount: %i (/64)\0A\00"
@.str.2 = [40 x i8] c"Dette programet printer ut en iindex.\0A\0A\00"
@.str.3 = [83 x i8] c"\09Use:\0A\0A\09./mergeIIndex fralot tillot type (Main | Anchor) spr\C3\A5k subname [bucket]\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 7
br i1 %20, label %21, label %53
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
store i32 %25, i32* %7
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i32 @atoi(i8* %28)
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 3
%33 = load i8*, i8** %32
store i8* %33, i8** %9
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 4
%36 = load i8*, i8** %35
store i8* %36, i8** %10
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 5
%39 = load i8*, i8** %38
store i8* %39, i8** %11
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 6
%42 = load i8*, i8** %41
%43 = call i32 @atol(i8* %42)
store i32 %43, i32* %12
%44 = load i32, i32* %12
%45 = load i32, i32* %7
%46 = load i32, i32* %8
%47 = load i8*, i8** %9
%48 = load i8*, i8** %10
%49 = load i8*, i8** %11
%50 = call i32 @mergei(i32 %44, i32 %45, i32 %46, i8* %47, i8* %48, i8* %49, i32* %6)
%51 = load i32, i32* %6
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %51)
br label %97
53: ; preds = %2
%54 = load i32, i32* %4
%55 = icmp eq i32 %54, 6
br i1 %55, label %56, label %92
56: ; preds = %53
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 1
%59 = load i8*, i8** %58
%60 = call i32 @atoi(i8* %59)
store i32 %60, i32* %14
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 2
%63 = load i8*, i8** %62
%64 = call i32 @atoi(i8* %63)
%65 = add nsw i32 %64, 1
store i32 %65, i32* %15
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 3
%68 = load i8*, i8** %67
store i8* %68, i8** %16
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 4
%71 = load i8*, i8** %70
store i8* %71, i8** %17
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 5
%74 = load i8*, i8** %73
store i8* %74, i8** %18
store i32 0, i32* %13
br label %75
75: ; preds = %86, %56
%76 = load i32, i32* %13
%77 = icmp sle i32 %76, 63
br i1 %77, label %78, label %89
78: ; preds = %75
%79 = load i32, i32* %13
%80 = load i32, i32* %14
%81 = load i32, i32* %15
%82 = load i8*, i8** %16
%83 = load i8*, i8** %17
%84 = load i8*, i8** %18
%85 = call i32 @mergei(i32 %79, i32 %80, i32 %81, i8* %82, i8* %83, i8* %84, i32* %6)
br label %86
86: ; preds = %78
%87 = load i32, i32* %13
%88 = add nsw i32 %87, 1
store i32 %88, i32* %13
br label %75
89: ; preds = %75
%90 = load i32, i32* %6
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %90)
br label %96
92: ; preds = %53
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.3, i64 0, i64 0))
%95 = call i32 @exit(i32 0)
unreachable
96: ; preds = %89
br label %97
97: ; preds = %96, %21
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"DocIDcount: %i\0A\00"
@.str.1 = [22 x i8] c"DocIDcount: %i (/64)\0A\00"
@str = [39 x i8] c"Dette programet printer ut en iindex.\0A\00"
@str.4 = [82 x i8] c"\09Use:\0A\0A\09./mergeIIndex fralot tillot type (Main | Anchor) spr\C3\A5k subname [bucket]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
switch i32 %0, label %47 [
i32 7, label %5
i32 6, label %25
]
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = add nsw i32 %11, 1
%13 = getelementptr inbounds i8*, i8** %1, i64 3
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 4
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8*, i8** %1, i64 5
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8*, i8** %1, i64 6
%20 = load i8*, i8** %19
%21 = tail call i32 @atol(i8* %20)
%22 = call i32 @mergei(i32 %21, i32 %8, i32 %12, i8* %14, i8* %16, i8* %18, i32* %3)
%23 = load i32, i32* %3
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %51
25: ; preds = %2
%26 = getelementptr inbounds i8*, i8** %1, i64 1
%27 = load i8*, i8** %26
%28 = tail call i32 @atoi(i8* %27)
%29 = getelementptr inbounds i8*, i8** %1, i64 2
%30 = load i8*, i8** %29
%31 = tail call i32 @atoi(i8* %30)
%32 = add nsw i32 %31, 1
%33 = getelementptr inbounds i8*, i8** %1, i64 3
%34 = load i8*, i8** %33
%35 = getelementptr inbounds i8*, i8** %1, i64 4
%36 = load i8*, i8** %35
%37 = getelementptr inbounds i8*, i8** %1, i64 5
%38 = load i8*, i8** %37
br label %39
39: ; preds = %25, %39
%40 = phi i32 [ 0, %25 ], [ %42, %39 ]
%41 = call i32 @mergei(i32 %40, i32 %28, i32 %32, i8* %34, i8* %36, i8* %38, i32* %3)
%42 = add nuw nsw i32 %40, 1
%43 = icmp eq i32 %42, 64
br i1 %43, label %44, label %39
44: ; preds = %39
%45 = load i32, i32* %3
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %45)
br label %51
47: ; preds = %2
%48 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([82 x i8], [82 x i8]* @str.4, i64 0, i64 0))
%50 = tail call i32 @exit(i32 0)
unreachable
51: ; preds = %44, %5
ret i32 0
}