#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 /*<<< orphan*/ subname;

/* Variables and functions */
int /*<<< orphan*/ GetFilPathForLot(char *, int, char *);
unsigned int GetLastIndexTimeForLot(int, char *);
int /*<<< orphan*/ IndekserSplice(char *);
int atoi(char *);
int /*<<< orphan*/ exit(int);
char getopt(int, char **, char *);
int /*<<< orphan*/ lotHasSufficientSpace(int, int, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char *argv[]) {
  int lotNr;
  int lotPart;
  char path[256];
  char iipath[256];
  unsigned lastIndexTime;
  char subname[512];
  extern char *optarg;
  extern int optind, opterr, optopt;
  char c;
  while ((c = getopt(argc, argv, "v")) != -1) {
    switch (c) {
    case 'v':
      break;
    default:
      exit(1);
    }
  }
  --optind;
  printf("lot %s, %i\n", argv[1], argc);
  if ((argc - optind) == 4) {
    lotNr = atoi(argv[2 + optind]);
    strncpy(subname, argv[3 + optind], sizeof(subname) - 1);
    lastIndexTime = GetLastIndexTimeForLot(lotNr, subname);
    if (lastIndexTime == 0) {
      printf("lastIndexTime is 0\n");
      exit(1);
    }
    if (!lotHasSufficientSpace(lotNr, 4096, subname)) {
      printf("insufficient disk space\n");
      exit(1);
    }
    printf("Indexing all buvkets for lot %i\n", lotNr);
    for (lotPart = 0; lotPart < 64; lotPart++) {
      GetFilPathForLot(path, lotNr, subname);
      sprintf(iipath, "%siindex/%s/index/aa/", path, argv[1 + optind]);
      sprintf(iipath, "%s%i.txt", iipath, lotPart);
      IndekserSplice(iipath);
    }
  } else if ((argc - optind) == 5) {
    lotNr = atoi(argv[2 + optind]);
    strncpy(subname, argv[3 + optind], sizeof(subname) - 1);
    lotPart = atoi(argv[4 + optind]);
    printf("indexint part %i for lot %i\n", lotPart, lotNr);
    GetFilPathForLot(path, lotNr, subname);
    sprintf(iipath, "%siindex/%s/index/aa/", path, argv[1 + optind]);
    sprintf(iipath, "%s%i.txt", iipath, lotPart);
    IndekserSplice(iipath);
  } else {
    printf("usage: ./LotInvertetIndexMaker type lotnr subname [ lotPart ]\n\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe39(%rip),%rdx
call   1090 <getopt@plt>
mov    %al,-0x431(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     1205 <main+0x65>
mov    -0x431(%rbp),%al
sub    $0x76,%al
jne    11f6 <main+0x56>
jmp    11f1 <main+0x51>
jmp    1200 <main+0x60>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    11b9 <main+0x19>
mov    0x2dd4(%rip),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    0x2dc8(%rip),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x8(%rbp),%edx
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    0x2da3(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x4,%eax
jne    13a7 <main+0x207>
mov    -0x10(%rbp),%rax
mov    0x2d8d(%rip),%rcx
mov    (%rcx),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x14(%rbp)
lea    -0x430(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x2d67(%rip),%rcx
mov    (%rcx),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0x1ff,%edx
call   1030 <strncpy@plt>
mov    -0x14(%rbp),%edi
lea    -0x430(%rbp),%rsi
call   1060 <GetLastIndexTimeForLot@plt>
mov    %eax,-0x224(%rbp)
cmpl   $0x0,-0x224(%rbp)
jne    12c9 <main+0x129>
lea    0xd56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x430(%rbp),%rdx
mov    $0x1000,%esi
call   1080 <lotHasSufficientSpace@plt>
cmp    $0x0,%eax
jne    12fe <main+0x15e>
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x14(%rbp),%esi
lea    0xd33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x40,-0x18(%rbp)
jge    13a2 <main+0x202>
lea    -0x120(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0x430(%rbp),%rdx
call   1050 <GetFilPathForLot@plt>
lea    -0x220(%rbp),%rdi
lea    -0x120(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    0x2c91(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xcfa(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x220(%rbp),%rdi
lea    -0x220(%rbp),%rdx
mov    -0x18(%rbp),%ecx
lea    0xcf1(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x220(%rbp),%rdi
call   1070 <IndekserSplice@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1316 <main+0x176>
jmp    14c2 <main+0x322>
mov    -0x8(%rbp),%eax
mov    0x2c2f(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x5,%eax
jne    14af <main+0x30f>
mov    -0x10(%rbp),%rax
mov    0x2c19(%rip),%rcx
mov    (%rcx),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x14(%rbp)
lea    -0x430(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x2bf3(%rip),%rcx
mov    (%rcx),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0x1ff,%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    0x2bd2(%rip),%rcx
mov    (%rcx),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xc4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x120(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0x430(%rbp),%rdx
call   1050 <GetFilPathForLot@plt>
lea    -0x220(%rbp),%rdi
lea    -0x120(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    0x2b7b(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xbe4(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x220(%rbp),%rdi
lea    -0x220(%rbp),%rdx
mov    -0x18(%rbp),%ecx
lea    0xbdb(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x220(%rbp),%rdi
call   1070 <IndekserSplice@plt>
jmp    14bd <main+0x31d>
lea    0xbe2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14c2 <main+0x322>
mov    -0x4(%rbp),%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
lea    0xe33(%rip),%rbx
nopl   (%rax)
mov    %ebp,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   10a0 <getopt@plt>
cmp    $0x76,%al
je     11d0 <main+0x20>
cmp    $0xff,%al
jne    13b9 <main+0x209>
mov    0x2df0(%rip),%r12
addl   $0xffffffff,(%r12)
mov    0x8(%r15),%rsi
lea    0xe02(%rip),%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
movslq (%r12),%rbx
sub    %ebx,%ebp
cmp    $0x5,%ebp
je     12f8 <main+0x148>
cmp    $0x4,%ebp
jne    1399 <main+0x1e9>
mov    0x10(%r15,%rbx,8),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r14d
mov    0x18(%r15,%rbx,8),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1ff,%edx
call   1030 <strncpy@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1070 <GetLastIndexTimeForLot@plt>
test   %eax,%eax
je     13c3 <main+0x213>
mov    %r12,%rbx
mov    %rsp,%rdx
mov    %r14d,%edi
mov    $0x1000,%esi
call   1090 <lotHasSufficientSpace@plt>
test   %eax,%eax
je     13cc <main+0x21c>
lea    0xd96(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x300(%rsp),%r13
lea    0x200(%rsp),%rbp
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
mov    %r14d,%esi
mov    %rsp,%rdx
call   1060 <GetFilPathForLot@plt>
movslq (%rbx),%rax
mov    0x8(%r15,%rax,8),%rcx
mov    %rbp,%rdi
lea    0xd6f(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   10c0 <sprintf@plt>
mov    %rbp,%rdi
lea    0xd71(%rip),%rsi
mov    %rbp,%rdx
mov    %r12d,%ecx
xor    %eax,%eax
call   10c0 <sprintf@plt>
mov    %rbp,%rdi
call   1080 <IndekserSplice@plt>
add    $0x1,%r12d
cmp    $0x40,%r12d
jne    12a0 <main+0xf0>
jmp    13a5 <main+0x1f5>
mov    0x10(%r15,%rbx,8),%rdi
call   10b0 <atoi@plt>
mov    %eax,%ebp
mov    0x18(%r15,%rbx,8),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x1ff,%edx
call   1030 <strncpy@plt>
movslq (%r12),%rax
mov    0x20(%r15,%rax,8),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r13d
lea    0xd1d(%rip),%rdi
mov    %eax,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rbx
lea    0x300(%rsp),%r12
mov    %r12,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1060 <GetFilPathForLot@plt>
movslq (%rbx),%rax
mov    0x8(%r15,%rax,8),%rcx
lea    0xccc(%rip),%rsi
lea    0x200(%rsp),%rbx
mov    %rbx,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   10c0 <sprintf@plt>
lea    0xcc6(%rip),%rsi
mov    %rbx,%rdi
mov    %rbx,%rdx
mov    %r13d,%ecx
xor    %eax,%eax
call   10c0 <sprintf@plt>
mov    %rbx,%rdi
call   1080 <IndekserSplice@plt>
jmp    13a5 <main+0x1f5>
lea    0xccb(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xcf8(%rip),%rdi
jmp    13d3 <main+0x223>
lea    0xcd7(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"v\00"
@optind = external global i32
@.str.1 = [12 x i8] c"lot %s, %i\0A\00"
@.str.2 = [20 x i8] c"lastIndexTime is 0\0A\00"
@.str.3 = [25 x i8] c"insufficient disk space\0A\00"
@.str.4 = [33 x i8] c"Indexing all buvkets for lot %i\0A\00"
@.str.5 = [22 x i8] c"%siindex/%s/index/aa/\00"
@.str.6 = [9 x i8] c"%s%i.txt\00"
@.str.7 = [29 x i8] c"indexint part %i for lot %i\0A\00"
@.str.8 = [64 x i8] c"usage: ./LotInvertetIndexMaker type lotnr subname [ lotPart ]\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 [256 x i8]
%9 = alloca [256 x i8]
%10 = alloca i32
%11 = alloca [512 x i8]
%12 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %13
13: ; preds = %25, %2
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call signext i8 @getopt(i32 %14, i8** %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8 %16, i8* %12
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %26
19: ; preds = %13
%20 = load i8, i8* %12
%21 = sext i8 %20 to i32
switch i32 %21, label %23 [
i32 118, label %22
]
22: ; preds = %19
br label %25
23: ; preds = %19
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %22
br label %13
26: ; preds = %13
%27 = load i32, i32* @optind
%28 = add nsw i32 %27, -1
store i32 %28, i32* @optind
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %31, i32 %32)
%34 = load i32, i32* %4
%35 = load i32, i32* @optind
%36 = sub nsw i32 %34, %35
%37 = icmp eq i32 %36, 4
br i1 %37, label %38, label %100
38: ; preds = %26
%39 = load i8**, i8*** %5
%40 = load i32, i32* @optind
%41 = add nsw i32 2, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %39, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
store i32 %45, i32* %6
%46 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%47 = load i8**, i8*** %5
%48 = load i32, i32* @optind
%49 = add nsw i32 3, %48
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8*, i8** %47, i64 %50
%52 = load i8*, i8** %51
%53 = call i32 @strncpy(i8* %46, i8* %52, i32 511)
%54 = load i32, i32* %6
%55 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%56 = call i32 @GetLastIndexTimeForLot(i32 %54, i8* %55)
store i32 %56, i32* %10
%57 = load i32, i32* %10
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %38
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %38
%63 = load i32, i32* %6
%64 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%65 = call i32 @lotHasSufficientSpace(i32 %63, i32 4096, i8* %64)
%66 = icmp ne i32 %65, 0
br i1 %66, label %70, label %67
67: ; preds = %62
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %62
%71 = load i32, i32* %6
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %71)
store i32 0, i32* %7
br label %73
73: ; preds = %96, %70
%74 = load i32, i32* %7
%75 = icmp slt i32 %74, 64
br i1 %75, label %76, label %99
76: ; preds = %73
%77 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%78 = load i32, i32* %6
%79 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%80 = call i32 @GetFilPathForLot(i8* %77, i32 %78, i8* %79)
%81 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%82 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%83 = load i8**, i8*** %5
%84 = load i32, i32* @optind
%85 = add nsw i32 1, %84
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8*, i8** %83, i64 %86
%88 = load i8*, i8** %87
%89 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %81, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %82, i8* %88)
%90 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%91 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%92 = load i32, i32* %7
%93 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %90, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %91, i32 %92)
%94 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%95 = call i32 @IndekserSplice(i8* %94)
br label %96
96: ; preds = %76
%97 = load i32, i32* %7
%98 = add nsw i32 %97, 1
store i32 %98, i32* %7
br label %73
99: ; preds = %73
br label %153
100: ; preds = %26
%101 = load i32, i32* %4
%102 = load i32, i32* @optind
%103 = sub nsw i32 %101, %102
%104 = icmp eq i32 %103, 5
br i1 %104, label %105, label %150
105: ; preds = %100
%106 = load i8**, i8*** %5
%107 = load i32, i32* @optind
%108 = add nsw i32 2, %107
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8*, i8** %106, i64 %109
%111 = load i8*, i8** %110
%112 = call i32 @atoi(i8* %111)
store i32 %112, i32* %6
%113 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%114 = load i8**, i8*** %5
%115 = load i32, i32* @optind
%116 = add nsw i32 3, %115
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i8*, i8** %114, i64 %117
%119 = load i8*, i8** %118
%120 = call i32 @strncpy(i8* %113, i8* %119, i32 511)
%121 = load i8**, i8*** %5
%122 = load i32, i32* @optind
%123 = add nsw i32 4, %122
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i8*, i8** %121, i64 %124
%126 = load i8*, i8** %125
%127 = call i32 @atoi(i8* %126)
store i32 %127, i32* %7
%128 = load i32, i32* %7
%129 = load i32, i32* %6
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i32 %128, i32 %129)
%131 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%132 = load i32, i32* %6
%133 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%134 = call i32 @GetFilPathForLot(i8* %131, i32 %132, i8* %133)
%135 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%136 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%137 = load i8**, i8*** %5
%138 = load i32, i32* @optind
%139 = add nsw i32 1, %138
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i8*, i8** %137, i64 %140
%142 = load i8*, i8** %141
%143 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %135, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %136, i8* %142)
%144 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%145 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%146 = load i32, i32* %7
%147 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %144, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %145, i32 %146)
%148 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%149 = call i32 @IndekserSplice(i8* %148)
br label %152
150: ; preds = %100
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.8, i64 0, i64 0))
br label %152
152: ; preds = %150, %105
br label %153
153: ; preds = %152, %99
%154 = load i32, i32* %3
ret i32 %154
}

LLVM IR (-O2):
@.str = [2 x i8] c"v\00"
@optind = external global i32
@.str.1 = [12 x i8] c"lot %s, %i\0A\00"
@.str.4 = [33 x i8] c"Indexing all buvkets for lot %i\0A\00"
@.str.5 = [22 x i8] c"%siindex/%s/index/aa/\00"
@.str.6 = [9 x i8] c"%s%i.txt\00"
@.str.7 = [29 x i8] c"indexint part %i for lot %i\0A\00"
@str = [63 x i8] c"usage: ./LotInvertetIndexMaker type lotnr subname [ lotPart ]\0A\00"
@str.9 = [24 x i8] c"insufficient disk space\00"
@str.10 = [19 x i8] c"lastIndexTime is 0\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = alloca [512 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
br label %9
9: ; preds = %9, %2
%10 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
switch i8 %10, label %11 [
i8 -1, label %13
i8 118, label %9
]
11: ; preds = %9
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %9
%14 = load i32, i32* @optind
%15 = add nsw i32 %14, -1
store i32 %15, i32* @optind
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %17, i32 %0)
%19 = load i32, i32* @optind
%20 = sub nsw i32 %0, %19
switch i32 %20, label %85 [
i32 4, label %21
i32 5, label %58
]
21: ; preds = %13
%22 = add nsw i32 %19, 2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %1, i64 %23
%25 = load i8*, i8** %24
%26 = tail call i32 @atoi(i8* %25)
%27 = add nsw i32 %19, 3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %1, i64 %28
%30 = load i8*, i8** %29
%31 = call i32 @strncpy(i8* %8, i8* %30, i32 511)
%32 = call i32 @GetLastIndexTimeForLot(i32 %26, i8* %8)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %21
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.10, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %21
%38 = call i32 @lotHasSufficientSpace(i32 %26, i32 4096, i8* %8)
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.9, i64 0, i64 0))
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %37
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %26)
br label %45
45: ; preds = %43, %45
%46 = phi i32 [ 0, %43 ], [ %56, %45 ]
%47 = call i32 @GetFilPathForLot(i8* %6, i32 %26, i8* %8)
%48 = load i32, i32* @optind
%49 = add nsw i32 %48, 1
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8*, i8** %1, i64 %50
%52 = load i8*, i8** %51
%53 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %6, i8* %52)
%54 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %7, i32 %46)
%55 = call i32 @IndekserSplice(i8* %7)
%56 = add nuw nsw i32 %46, 1
%57 = icmp eq i32 %56, 64
br i1 %57, label %87, label %45
58: ; preds = %13
%59 = add nsw i32 %19, 2
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8*, i8** %1, i64 %60
%62 = load i8*, i8** %61
%63 = tail call i32 @atoi(i8* %62)
%64 = add nsw i32 %19, 3
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8*, i8** %1, i64 %65
%67 = load i8*, i8** %66
%68 = call i32 @strncpy(i8* %8, i8* %67, i32 511)
%69 = load i32, i32* @optind
%70 = add nsw i32 %69, 4
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8*, i8** %1, i64 %71
%73 = load i8*, i8** %72
%74 = call i32 @atoi(i8* %73)
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i32 %74, i32 %63)
%76 = call i32 @GetFilPathForLot(i8* %6, i32 %63, i8* %8)
%77 = load i32, i32* @optind
%78 = add nsw i32 %77, 1
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %1, i64 %79
%81 = load i8*, i8** %80
%82 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %6, i8* %81)
%83 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %7, i32 %74)
%84 = call i32 @IndekserSplice(i8* %7)
br label %87
85: ; preds = %13
%86 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str, i64 0, i64 0))
br label %87
87: ; preds = %45, %58, %85
ret i32 0
}