#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*/ line;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ chomp(char *);
int /*<<< orphan*/ close(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int getDocIDFromUrl(char *, char *, unsigned int *);
char getopt(int, char **, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ show(char *, int, unsigned int);
int /*<<< orphan*/ showOK(char *, int);
int /*<<< orphan*/ url_normalization(char *, int);
int main(int argc, char *argv[]) {
  char *filename = NULL;
  char *bdbfiles;
  unsigned int DocID;
  int Found, NotFound;
  FILE *FH;
  int i;
  char line[512];
  int n;
  int optShowOK = 0;
  int optFiles = 0;
  extern char *optarg;
  extern int optind, opterr, optopt;
  char c;
  while ((c = getopt(argc, argv, "fk")) != -1) {
    switch (c) {
    case 'k':
      optShowOK = 1;
      break;
    case 'f':
      optFiles = 1;
      break;
    default:
      printf("wron parameter\n");
      exit(1);
    }
  }
  --optind;
  if (optFiles != 0) {
    if (argc - optind < 2) {
      printf("Dette programet viser DocID for urler. Eventuelt urler i text  "
             "filer\n\n\tBruke\n\tUrlToDocIDQuery -f bdbfiledir file [ file "
             "..n ]\n\n");
      exit(0);
    }
    bdbfiles = argv[1 + optind];
    printf("bdbfile \"%s\"\n", bdbfiles);
    Found = NotFound = 0;
    for (i = optind + 2; i < argc; i++) {
      filename = argv[i];
      printf("######################################################\n");
      printf(" Filename \"%s\"\n", filename);
      printf("######################################################\n");
      if ((FH = fopen(filename, "r")) == NULL) {
        perror(filename);
        continue;
      }
      while (fgets(line, sizeof(line), FH) != NULL) {
        chomp(line);
        url_normalization(line, sizeof(line));
        n = getDocIDFromUrl(bdbfiles, line, &DocID);
        if (n) {
          ++Found;
        } else {
          ++NotFound;
        }
        if (optShowOK) {
          showOK(line, n);
        } else {
          show(line, n, DocID);
        }
      }
      close(FH);
      printf("Found %i\nNot Found %i\n\n\n", Found, NotFound);
    }
  } else {
    if (argc != 3) {
      printf("Dette programet indekserer en ud "
             "file\n\n\tBruke\n\tUrlToDocIDQuery bdbfiledir url\n\n");
      exit(0);
    }
    n = getDocIDFromUrl(argv[1], argv[2], &DocID);
    show(argv[2], n, DocID);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x248(%rbp)
movl   $0x0,-0x24c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdfd(%rip),%rdx
call   10c0 <getopt@plt>
mov    %al,-0x24d(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     1284 <main+0xc4>
movsbl -0x24d(%rbp),%eax
mov    %eax,-0x254(%rbp)
sub    $0x66,%eax
je     1258 <main+0x98>
jmp    1235 <main+0x75>
mov    -0x254(%rbp),%eax
sub    $0x6b,%eax
jne    1267 <main+0xa7>
jmp    1249 <main+0x89>
movl   $0x1,-0x248(%rbp)
jmp    127f <main+0xbf>
movl   $0x1,-0x24c(%rbp)
jmp    127f <main+0xbf>
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    11f5 <main+0x35>
mov    0x2d55(%rip),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    0x2d49(%rip),%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x24c(%rbp)
je     147d <main+0x2bd>
mov    -0x8(%rbp),%eax
mov    0x2d30(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x2,%eax
jge    12d0 <main+0x110>
lea    0xd51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x2d05(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x28(%rbp)
mov    0x2cce(%rip),%rax
mov    (%rax),%eax
add    $0x2,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1478 <main+0x2b8>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xd7a(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    1390 <main+0x1d0>
mov    -0x18(%rbp),%rdi
call   10b0 <perror@plt>
jmp    146a <main+0x2aa>
jmp    1395 <main+0x1d5>
lea    -0x240(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    $0x200,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     144d <main+0x28d>
lea    -0x240(%rbp),%rdi
call   1090 <chomp@plt>
lea    -0x240(%rbp),%rdi
mov    $0x200,%esi
call   10e0 <url_normalization@plt>
mov    -0x20(%rbp),%rdi
lea    -0x240(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   1030 <getDocIDFromUrl@plt>
mov    %eax,-0x244(%rbp)
cmpl   $0x0,-0x244(%rbp)
je     1406 <main+0x246>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    140f <main+0x24f>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x248(%rbp)
je     1433 <main+0x273>
lea    -0x240(%rbp),%rdi
mov    -0x244(%rbp),%esi
call   1080 <showOK@plt>
jmp    1448 <main+0x288>
lea    -0x240(%rbp),%rdi
mov    -0x244(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1060 <show@plt>
jmp    1395 <main+0x1d5>
mov    -0x38(%rbp),%rdi
call   1050 <close@plt>
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
lea    0xc88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    131a <main+0x15a>
jmp    14d1 <main+0x311>
cmpl   $0x3,-0x8(%rbp)
je     149c <main+0x2dc>
lea    0xc76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x24(%rbp),%rdx
call   1030 <getDocIDFromUrl@plt>
mov    %eax,-0x244(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x244(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1060 <show@plt>
mov    -0x4(%rbp),%eax
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
mov    %rsi,%rbx
mov    %edi,%r13d
lea    0xe12(%rip),%rdx
call   10d0 <getopt@plt>
cmp    $0xff,%al
je     13ec <main+0x21c>
xor    %ebp,%ebp
lea    0xdfc(%rip),%r14
xor    %ecx,%ecx
jmp    1225 <main+0x55>
nopl   0x0(%rax,%rax,1)
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   10d0 <getopt@plt>
mov    %r15d,%ecx
cmp    $0xff,%al
je     1246 <main+0x76>
movsbl %al,%eax
mov    $0x1,%r15d
cmp    $0x6b,%eax
je     1210 <main+0x40>
cmp    $0x66,%eax
jne    142e <main+0x25e>
mov    $0x1,%ebp
mov    %ecx,%r15d
jmp    1210 <main+0x40>
mov    0x2d93(%rip),%r14
movslq (%r14),%rax
lea    -0x1(%rax),%ecx
mov    %ecx,(%r14)
test   %ebp,%ebp
je     13f6 <main+0x226>
mov    %r13d,%edx
sub    %ecx,%edx
cmp    $0x1,%edx
jle    144d <main+0x27d>
mov    (%rbx,%rax,8),%rsi
lea    0xd8c(%rip),%rdi
mov    %rsi,0x20(%rsp)
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r14),%eax
add    $0x2,%eax
cmp    %r13d,%eax
jge    141a <main+0x24a>
movslq %eax,%rbp
movl   $0x0,0x4(%rsp)
xor    %r14d,%r14d
mov    %rbx,0x10(%rsp)
mov    %r13d,0x8(%rsp)
mov    %r15d,0xc(%rsp)
nop
mov    (%rbx,%rbp,8),%rbx
lea    0xdce(%rip),%r12
mov    %r12,%rdi
call   1040 <puts@plt>
lea    0xd47(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%r12
call   1040 <puts@plt>
mov    %rbx,%rdi
lea    0xe63(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13da <main+0x20a>
mov    %rax,%rbx
mov    %rbp,0x18(%rsp)
lea    0x30(%rsp),%r15
mov    %r15,%rdi
mov    $0x200,%esi
mov    %rax,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
mov    %rbx,0x28(%rsp)
jne    1394 <main+0x1c4>
mov    %rbx,%rdi
call   1060 <close@plt>
lea    0xcf4(%rip),%rdi
mov    0x4(%rsp),%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rbx
mov    0x8(%rsp),%r13d
mov    0x18(%rsp),%rbp
add    $0x1,%rbp
cmp    %r13d,%ebp
jne    12b0 <main+0xe0>
jmp    141a <main+0x24a>
nopl   0x0(%rax)
mov    (%rsp),%edx
mov    %r15,%rdi
mov    %eax,%esi
call   1070 <show@plt>
mov    %r12b,%bpl
add    %ebp,%r14d
mov    %r13b,%bl
add    %ebx,0x4(%rsp)
mov    %r15,%rdi
mov    $0x200,%esi
mov    0x28(%rsp),%rbx
mov    %rbx,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     131e <main+0x14e>
mov    %r15,%rdi
call   10a0 <chomp@plt>
mov    %r15,%rdi
mov    $0x200,%esi
call   10f0 <url_normalization@plt>
mov    0x20(%rsp),%rdi
mov    %r15,%rsi
mov    %rsp,%rdx
call   1030 <getDocIDFromUrl@plt>
xor    %ebx,%ebx
xor    %ebp,%ebp
test   %eax,%eax
setne  %r13b
sete   %r12b
cmpl   $0x0,0xc(%rsp)
je     1360 <main+0x190>
mov    %r15,%rdi
mov    %eax,%esi
call   1090 <showOK@plt>
jmp    136d <main+0x19d>
mov    %r12,%rdi
call   10c0 <perror@plt>
mov    0x10(%rsp),%rbx
jmp    134a <main+0x17a>
mov    0x2bed(%rip),%rax
addl   $0xffffffff,(%rax)
cmp    $0x3,%r13d
jne    1444 <main+0x274>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
mov    %rsp,%rdx
call   1030 <getDocIDFromUrl@plt>
mov    0x10(%rbx),%rdi
mov    (%rsp),%edx
mov    %eax,%esi
call   1070 <show@plt>
xor    %eax,%eax
add    $0x238,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd0a(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    0xbef(%rip),%rdi
jmp    1454 <main+0x284>
lea    0xc6c(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"fk\00"
@.str.1 = [16 x i8] c"wron parameter\0A\00"
@optind = external global i32
@.str.2 = [128 x i8] c"Dette programet viser DocID for urler. Eventuelt urler i text filer\0A\0A\09Bruke\0A\09UrlToDocIDQuery -f bdbfiledir file [ file ..n ]\0A\0A\00"
@.str.3 = [14 x i8] c"bdbfile \22%s\22\0A\00"
@.str.4 = [56 x i8] c"######################################################\0A\00"
@.str.5 = [16 x i8] c" Filename \22%s\22\0A\00"
@.str.6 = [2 x i8] c"r\00"
@.str.7 = [25 x i8] c"Found %i\0ANot Found %i\0A\0A\0A\00"
@.str.8 = [80 x i8] c"Dette programet indekserer en ud file\0A\0A\09Bruke\0A\09UrlToDocIDQuery bdbfiledir url\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
%13 = alloca [512 x i8]
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i32 0, i32* %15
store i32 0, i32* %16
br label %18
18: ; preds = %32, %2
%19 = load i32, i32* %4
%20 = load i8**, i8*** %5
%21 = call signext i8 @getopt(i32 %19, i8** %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8 %21, i8* %17
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, -1
br i1 %23, label %24, label %33
24: ; preds = %18
%25 = load i8, i8* %17
%26 = sext i8 %25 to i32
switch i32 %26, label %29 [
i32 107, label %27
i32 102, label %28
]
27: ; preds = %24
store i32 1, i32* %15
br label %32
28: ; preds = %24
store i32 1, i32* %16
br label %32
29: ; preds = %24
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %28, %27
br label %18
33: ; preds = %18
%34 = load i32, i32* @optind
%35 = add nsw i32 %34, -1
store i32 %35, i32* @optind
%36 = load i32, i32* %16
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %122
38: ; preds = %33
%39 = load i32, i32* %4
%40 = load i32, i32* @optind
%41 = sub nsw i32 %39, %40
%42 = icmp slt i32 %41, 2
br i1 %42, label %43, label %46
43: ; preds = %38
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str.2, i64 0, i64 0))
%45 = call i32 @exit(i32 0)
unreachable
46: ; preds = %38
%47 = load i8**, i8*** %5
%48 = load i32, i32* @optind
%49 = add nsw i32 1, %48
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8*, i8** %47, i64 %50
%52 = load i8*, i8** %51
store i8* %52, i8** %7
%53 = load i8*, i8** %7
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %53)
store i32 0, i32* %10
store i32 0, i32* %9
%55 = load i32, i32* @optind
%56 = add nsw i32 %55, 2
store i32 %56, i32* %12
br label %57
57: ; preds = %118, %46
%58 = load i32, i32* %12
%59 = load i32, i32* %4
%60 = icmp slt i32 %58, %59
br i1 %60, label %61, label %121
61: ; preds = %57
%62 = load i8**, i8*** %5
%63 = load i32, i32* %12
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8*, i8** %62, i64 %64
%66 = load i8*, i8** %65
store i8* %66, i8** %6
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0))
%68 = load i8*, i8** %6
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %68)
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0))
%71 = load i8*, i8** %6
%72 = call i32* @fopen(i8* %71, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %72, i32** %11
%73 = icmp eq i32* %72, null
br i1 %73, label %74, label %77
74: ; preds = %61
%75 = load i8*, i8** %6
%76 = call i32 @perror(i8* %75)
br label %118
77: ; preds = %61
br label %78
78: ; preds = %111, %77
%79 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%80 = load i32*, i32** %11
%81 = call i32* @fgets(i8* %79, i32 512, i32* %80)
%82 = icmp ne i32* %81, null
br i1 %82, label %83, label %112
83: ; preds = %78
%84 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%85 = call i32 @chomp(i8* %84)
%86 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%87 = call i32 @url_normalization(i8* %86, i32 512)
%88 = load i8*, i8** %7
%89 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%90 = call i32 @getDocIDFromUrl(i8* %88, i8* %89, i32* %8)
store i32 %90, i32* %14
%91 = load i32, i32* %14
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %96
93: ; preds = %83
%94 = load i32, i32* %9
%95 = add nsw i32 %94, 1
store i32 %95, i32* %9
br label %99
96: ; preds = %83
%97 = load i32, i32* %10
%98 = add nsw i32 %97, 1
store i32 %98, i32* %10
br label %99
99: ; preds = %96, %93
%100 = load i32, i32* %15
%101 = icmp ne i32 %100, 0
br i1 %101, label %102, label %106
102: ; preds = %99
%103 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%104 = load i32, i32* %14
%105 = call i32 @showOK(i8* %103, i32 %104)
br label %111
106: ; preds = %99
%107 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%108 = load i32, i32* %14
%109 = load i32, i32* %8
%110 = call i32 @show(i8* %107, i32 %108, i32 %109)
br label %111
111: ; preds = %106, %102
br label %78
112: ; preds = %78
%113 = load i32*, i32** %11
%114 = call i32 @close(i32* %113)
%115 = load i32, i32* %9
%116 = load i32, i32* %10
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %115, i32 %116)
br label %118
118: ; preds = %112, %74
%119 = load i32, i32* %12
%120 = add nsw i32 %119, 1
store i32 %120, i32* %12
br label %57
121: ; preds = %57
br label %142
122: ; preds = %33
%123 = load i32, i32* %4
%124 = icmp ne i32 %123, 3
br i1 %124, label %125, label %128
125: ; preds = %122
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.8, i64 0, i64 0))
%127 = call i32 @exit(i32 0)
unreachable
128: ; preds = %122
%129 = load i8**, i8*** %5
%130 = getelementptr inbounds i8*, i8** %129, i64 1
%131 = load i8*, i8** %130
%132 = load i8**, i8*** %5
%133 = getelementptr inbounds i8*, i8** %132, i64 2
%134 = load i8*, i8** %133
%135 = call i32 @getDocIDFromUrl(i8* %131, i8* %134, i32* %8)
store i32 %135, i32* %14
%136 = load i8**, i8*** %5
%137 = getelementptr inbounds i8*, i8** %136, i64 2
%138 = load i8*, i8** %137
%139 = load i32, i32* %14
%140 = load i32, i32* %8
%141 = call i32 @show(i8* %138, i32 %139, i32 %140)
br label %142
142: ; preds = %128, %121
%143 = load i32, i32* %3
ret i32 %143
}

LLVM IR (-O2):
@.str = [3 x i8] c"fk\00"
@optind = external global i32
@.str.3 = [14 x i8] c"bdbfile \22%s\22\0A\00"
@.str.5 = [16 x i8] c" Filename \22%s\22\0A\00"
@.str.6 = [2 x i8] c"r\00"
@.str.7 = [25 x i8] c"Found %i\0ANot Found %i\0A\0A\0A\00"
@str = [79 x i8] c"Dette programet indekserer en ud file\0A\0A\09Bruke\0A\09UrlToDocIDQuery bdbfiledir url\0A\00"
@str.10 = [55 x i8] c"######################################################\00"
@str.11 = [127 x i8] c"Dette programet viser DocID for urler. Eventuelt urler i text filer\0A\0A\09Bruke\0A\09UrlToDocIDQuery -f bdbfiledir file [ file ..n ]\0A\00"
@str.12 = [15 x i8] c"wron parameter\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca [512 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i8 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* @optind
%11 = add nsw i32 %10, -1
store i32 %11, i32* @optind
br label %94
12: ; preds = %2, %21
%13 = phi i8 [ %24, %21 ], [ %7, %2 ]
%14 = phi i32 [ %23, %21 ], [ 0, %2 ]
%15 = phi i32 [ %22, %21 ], [ 0, %2 ]
%16 = sext i8 %13 to i32
switch i32 %16, label %18 [
i32 107, label %21
i32 102, label %17
]
17: ; preds = %12
br label %21
18: ; preds = %12
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.12, i64 0, i64 0))
%20 = tail call i32 @exit(i32 1)
unreachable
21: ; preds = %12, %17
%22 = phi i32 [ %15, %17 ], [ 1, %12 ]
%23 = phi i32 [ 1, %17 ], [ %14, %12 ]
%24 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i8 %24, -1
br i1 %25, label %26, label %12
26: ; preds = %21
%27 = load i32, i32* @optind
%28 = add nsw i32 %27, -1
store i32 %28, i32* @optind
%29 = icmp eq i32 %23, 0
br i1 %29, label %94, label %30
30: ; preds = %26
%31 = sub nsw i32 %0, %28
%32 = icmp slt i32 %31, 2
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([127 x i8], [127 x i8]* @str.11, i64 0, i64 0))
%35 = tail call i32 @exit(i32 0)
unreachable
36: ; preds = %30
%37 = sext i32 %27 to i64
%38 = getelementptr inbounds i8*, i8** %1, i64 %37
%39 = load i8*, i8** %38
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %39)
%41 = load i32, i32* @optind
%42 = add i32 %41, 2
%43 = icmp slt i32 %42, %0
br i1 %43, label %44, label %108
44: ; preds = %36
%45 = icmp eq i32 %22, 0
%46 = sext i32 %42 to i64
br label %47
47: ; preds = %44, %88
%48 = phi i64 [ %46, %44 ], [ %91, %88 ]
%49 = phi i32 [ 0, %44 ], [ %90, %88 ]
%50 = phi i32 [ 0, %44 ], [ %89, %88 ]
%51 = getelementptr inbounds i8*, i8** %1, i64 %48
%52 = load i8*, i8** %51
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.10, i64 0, i64 0))
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %52)
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.10, i64 0, i64 0))
%56 = call i32* @fopen(i8* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%57 = icmp eq i32* %56, null
br i1 %57, label %61, label %58
58: ; preds = %47
%59 = call i32* @fgets(i8* %6, i32 512, i32* %56)
%60 = icmp eq i32* %59, null
br i1 %60, label %83, label %63
61: ; preds = %47
%62 = call i32 @perror(i8* %52)
br label %88
63: ; preds = %58, %80
%64 = phi i32 [ %74, %80 ], [ %49, %58 ]
%65 = phi i32 [ %71, %80 ], [ %50, %58 ]
%66 = call i32 @chomp(i8* %6)
%67 = call i32 @url_normalization(i8* %6, i32 512)
%68 = call i32 @getDocIDFromUrl(i8* %39, i8* %6, i32* %3)
%69 = icmp eq i32 %68, 0
%70 = zext i1 %69 to i32
%71 = add nsw i32 %65, %70
%72 = xor i1 %69, true
%73 = zext i1 %72 to i32
%74 = add nsw i32 %64, %73
br i1 %45, label %77, label %75
75: ; preds = %63
%76 = call i32 @showOK(i8* %6, i32 %68)
br label %80
77: ; preds = %63
%78 = load i32, i32* %3
%79 = call i32 @show(i8* %6, i32 %68, i32 %78)
br label %80
80: ; preds = %77, %75
%81 = call i32* @fgets(i8* %6, i32 512, i32* %56)
%82 = icmp eq i32* %81, null
br i1 %82, label %83, label %63
83: ; preds = %80, %58
%84 = phi i32 [ %50, %58 ], [ %71, %80 ]
%85 = phi i32 [ %49, %58 ], [ %74, %80 ]
%86 = call i32 @close(i32* %56)
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %85, i32 %84)
br label %88
88: ; preds = %83, %61
%89 = phi i32 [ %50, %61 ], [ %84, %83 ]
%90 = phi i32 [ %49, %61 ], [ %85, %83 ]
%91 = add nsw i64 %48, 1
%92 = trunc i64 %91 to i32
%93 = icmp eq i32 %92, %0
br i1 %93, label %108, label %47
94: ; preds = %9, %26
%95 = icmp eq i32 %0, 3
br i1 %95, label %99, label %96
96: ; preds = %94
%97 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @str, i64 0, i64 0))
%98 = tail call i32 @exit(i32 0)
unreachable
99: ; preds = %94
%100 = getelementptr inbounds i8*, i8** %1, i64 1
%101 = load i8*, i8** %100
%102 = getelementptr inbounds i8*, i8** %1, i64 2
%103 = load i8*, i8** %102
%104 = call i32 @getDocIDFromUrl(i8* %101, i8* %103, i32* %3)
%105 = load i8*, i8** %102
%106 = load i32, i32* %3
%107 = call i32 @show(i8* %105, i32 %104, i32 %106)
br label %108
108: ; preds = %88, %36, %99
ret i32 0
}