#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 *);
int /*<<< orphan*/ _Indekser(char *);
int atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char *argv[]) {
  int lotNr;
  int lotPart;
  char path[256];
  char revpath[256];
  char iipath[256];
  unsigned lastIndexTime;
  char subname[512];
  int optMustBeNewerThen = 0;
  int optUnlink = 0;
  printf("lot %s, %i\n", argv[1], argc);
  if ((argc) == 5) {
    lotNr = atoi(argv[2]);
    strncpy(subname, argv[3], sizeof(subname) - 1);
    lotPart = atoi(argv[4]);
    printf("indexint part %i for lot %i\n", lotPart, lotNr);
    GetFilPathForLot(path, lotNr, subname);
    sprintf(revpath, "%srevindex/%s/%i.txt", path, argv[1], lotPart);
    _Indekser(revpath);
  } else {
    printf("usage: ./LotInvertetIndexMaker type lotnr subname lotPart\n\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x540,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x534(%rbp)
movl   $0x0,-0x538(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x8(%rbp),%edx
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x5,-0x8(%rbp)
jne    124a <main+0xea>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
lea    -0x530(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    $0x1ff,%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x120(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0x530(%rbp),%rdx
call   1050 <GetFilPathForLot@plt>
lea    -0x220(%rbp),%rdi
lea    -0x120(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x18(%rbp),%r8d
lea    0xdf5(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x220(%rbp),%rdi
call   1080 <_Indekser@plt>
jmp    1258 <main+0xf8>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x540,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rsi
lea    0xe71(%rip),%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x5,%ebp
jne    121c <main+0xac>
mov    0x10(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%r15d
mov    0x18(%rbx),%rsi
lea    0x200(%rsp),%r14
mov    %r14,%rdi
mov    $0x1ff,%edx
call   1030 <strncpy@plt>
mov    0x20(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
lea    0xe38(%rip),%rdi
mov    %eax,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x100(%rsp),%r12
mov    %r12,%rdi
mov    %r15d,%esi
mov    %r14,%rdx
call   1060 <GetFilPathForLot@plt>
mov    0x8(%rbx),%rcx
lea    0xe28(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %ebp,%r8d
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1090 <_Indekser@plt>
jmp    1228 <main+0xb8>
lea    0xe1b(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"lot %s, %i\0A\00"
@.str.1 = [29 x i8] c"indexint part %i for lot %i\0A\00"
@.str.2 = [21 x i8] c"%srevindex/%s/%i.txt\00"
@.str.3 = [60 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 [256 x i8]
%11 = alloca i32
%12 = alloca [512 x i8]
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %13
store i32 0, i32* %14
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = load i32, i32* %4
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %17, i32 %18)
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 5
br i1 %21, label %22, label %52
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %6
%27 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 3
%30 = load i8*, i8** %29
%31 = call i32 @strncpy(i8* %27, i8* %30, i32 511)
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 4
%34 = load i8*, i8** %33
%35 = call i32 @atoi(i8* %34)
store i32 %35, i32* %7
%36 = load i32, i32* %7
%37 = load i32, i32* %6
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %36, i32 %37)
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%40 = load i32, i32* %6
%41 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%42 = call i32 @GetFilPathForLot(i8* %39, i32 %40, i8* %41)
%43 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%44 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 1
%47 = load i8*, i8** %46
%48 = load i32, i32* %7
%49 = call i32 @sprintf(i8* %43, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %44, i8* %47, i32 %48)
%50 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%51 = call i32 @_Indekser(i8* %50)
br label %54
52: ; preds = %2
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0))
br label %54
54: ; preds = %52, %22
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
@.str = [12 x i8] c"lot %s, %i\0A\00"
@.str.1 = [29 x i8] c"indexint part %i for lot %i\0A\00"
@.str.2 = [21 x i8] c"%srevindex/%s/%i.txt\00"
@str = [59 x i8] c"usage: ./LotInvertetIndexMaker type lotnr subname lotPart\0A\00"
define i32 @main(i32 %0, i8** nocapture %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
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %0)
%12 = icmp eq i32 %0, 5
br i1 %12, label %13, label %28
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = call i32 @strncpy(i8* %8, i8* %18, i32 511)
%20 = getelementptr inbounds i8*, i8** %1, i64 4
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %16)
%24 = call i32 @GetFilPathForLot(i8* %6, i32 %16, i8* %8)
%25 = load i8*, i8** %9
%26 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* %25, i32 %22)
%27 = call i32 @_Indekser(i8* %7)
br label %30
28: ; preds = %2
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
br label %30
30: ; preds = %28, %13
ret i32 0
}