#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 /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ add_languages();
int /*<<< orphan*/ define_program_icons();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ modpath(char *);
int /*<<< orphan*/ preamble(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ set_registry_entries();
int split_path(char *, char **);
int sscanf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
char *strrchr(char *, char);
scalar_t__ strstr(char *, char *);
int /*<<< orphan*/ tailstrip(char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  char *pathbits[8];
  char line[512];
  char version[16];
  char arch[8];
  char *path;
  int x64 = 0;
  int i, n;
  if (fgets(line, sizeof line, stdin) == NULL) {
    usage(argv[0]);
  }
  if (strlen(line) < 11) {
    fprintf(stderr, "malformed MANIFEST: expected VERSION ...\n");
    exit(EXIT_FAILURE);
  }
  *version = *arch = '\0';
  n = sscanf(line + 8, "%15s %7s", version, arch);
  if (n < 1) {
    fprintf(stderr, "malformed MANIFEST: expected VERSION ...\n");
    exit(EXIT_FAILURE);
  } else if (n == 2) {
    if (!strcmp(arch, "x64")) {
      x64 = 1;
      fprintf(stderr, "Making installer script for gretl version %s (x64)...\n",
              version);
    } else {
      fprintf(stderr,
              "malformed MANIFEST: if arch is present, it must be \"x64\"\n");
      exit(EXIT_FAILURE);
    }
  } else {
    fprintf(stderr, "Making installer script for gretl version %s...\n",
            version);
  }
  preamble(version, x64);
  add_languages();
  printf("\n[Files]\n");
  while (fgets(line, sizeof line, stdin)) {
    if (strstr(line, "VERSION") || strstr(line, "DATE")) {
      continue;
    }
    tailstrip(line);
    path = strrchr(line, ' ');
    if (path == NULL) {
      continue;
    }
    path++;
    modpath(path);
    printf("Source: \"%s\"; ", path);
    n = split_path(path, pathbits);
    printf("Destdir: \"{app}");
    for (i = 1; i < n - 1; i++) {
      printf("\\%s", pathbits[i]);
    }
    printf("\"\n");
  }
  define_program_icons();
  set_registry_entries();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x280,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x274(%rbp)
lea    -0x250(%rbp),%rdi
mov    0x2da7(%rip),%rax
mov    (%rax),%edx
mov    $0x200,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    1263 <main+0x53>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10f0 <usage@plt>
lea    -0x250(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xb,%eax
jge    129d <main+0x8d>
mov    0x2d59(%rip),%rax
mov    (%rax),%edi
lea    0xd78(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2d3a(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
movb   $0x0,-0x268(%rbp)
movb   $0x0,-0x260(%rbp)
lea    -0x250(%rbp),%rdi
add    $0x8,%rdi
lea    -0x260(%rbp),%rdx
lea    -0x268(%rbp),%rcx
lea    0xd5f(%rip),%rsi
call   10e0 <sscanf@plt>
mov    %eax,-0x27c(%rbp)
cmpl   $0x1,-0x27c(%rbp)
jge    1308 <main+0xf8>
mov    0x2cee(%rip),%rax
mov    (%rax),%edi
lea    0xd0d(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2ccf(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
cmpl   $0x2,-0x27c(%rbp)
jne    1388 <main+0x178>
lea    -0x268(%rbp),%rdi
lea    0xd10(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    135e <main+0x14e>
movl   $0x1,-0x274(%rbp)
mov    0x2c96(%rip),%rax
mov    (%rax),%edi
lea    -0x260(%rbp),%rdx
lea    0xce5(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    1383 <main+0x173>
mov    0x2c73(%rip),%rax
mov    (%rax),%edi
lea    0xd00(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2c54(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
jmp    13a6 <main+0x196>
mov    0x2c49(%rip),%rax
mov    (%rax),%edi
lea    -0x260(%rbp),%rdx
lea    0xd09(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    13ab <main+0x19b>
lea    -0x260(%rbp),%rdi
mov    -0x274(%rbp),%esi
call   1100 <preamble@plt>
mov    $0x0,%al
call   1070 <add_languages@plt>
lea    0xd0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x250(%rbp),%rdi
mov    0x2c08(%rip),%rax
mov    (%rax),%edx
mov    $0x200,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     1525 <main+0x315>
lea    -0x250(%rbp),%rdi
lea    0xcdf(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%rax
jne    1430 <main+0x220>
lea    -0x250(%rbp),%rdi
lea    0xcca(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%rax
je     1435 <main+0x225>
jmp    13d2 <main+0x1c2>
lea    -0x250(%rbp),%rdi
call   1060 <tailstrip@plt>
lea    -0x250(%rbp),%rdi
mov    $0x20,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x270(%rbp)
cmpq   $0x0,-0x270(%rbp)
jne    146c <main+0x25c>
jmp    13d2 <main+0x1c2>
mov    -0x270(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x270(%rbp)
mov    -0x270(%rbp),%rdi
call   10c0 <modpath@plt>
mov    -0x270(%rbp),%rsi
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x270(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   10d0 <split_path@plt>
mov    %eax,-0x27c(%rbp)
lea    0xc43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x278(%rbp)
mov    -0x278(%rbp),%eax
mov    -0x27c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1512 <main+0x302>
movslq -0x278(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rsi
lea    0xc18(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x278(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x278(%rbp)
jmp    14cd <main+0x2bd>
lea    0xb8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13d2 <main+0x1c2>
mov    $0x0,%al
call   10b0 <define_program_icons@plt>
mov    $0x0,%al
call   1130 <set_registry_entries@plt>
xor    %eax,%eax
add    $0x280,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x268,%rsp
mov    %rsi,%rbx
mov    0x2dbd(%rip),%r13
mov    0x0(%r13),%edx
lea    0x60(%rsp),%rdi
mov    $0x200,%esi
call   1090 <fgets@plt>
test   %rax,%rax
jne    124b <main+0x3b>
mov    (%rbx),%rdi
call   10f0 <usage@plt>
lea    0x60(%rsp),%rdi
call   1040 <strlen@plt>
cmp    $0xa,%eax
jle    143f <main+0x22f>
movb   $0x0,0x8(%rsp)
movb   $0x0,0x10(%rsp)
lea    0x68(%rsp),%rdi
lea    0xdb6(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   10e0 <sscanf@plt>
test   %eax,%eax
jle    143f <main+0x22f>
cmp    $0x2,%eax
jne    12c1 <main+0xb1>
cmpl   $0x343678,0x8(%rsp)
mov    0x2d39(%rip),%rax
mov    (%rax),%edi
jne    1451 <main+0x241>
lea    0xd89(%rip),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%ebx
jmp    12df <main+0xcf>
mov    0x2d10(%rip),%rax
mov    (%rax),%edi
lea    0xdd7(%rip),%rsi
xor    %ebx,%ebx
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
lea    0x10(%rsp),%rdi
mov    %ebx,%esi
call   1100 <preamble@plt>
xor    %eax,%eax
call   1080 <add_languages@plt>
lea    0xe10(%rip),%rdi
call   1030 <puts@plt>
mov    0x0(%r13),%edx
lea    0x60(%rsp),%rdi
mov    $0x200,%esi
call   1090 <fgets@plt>
test   %rax,%rax
je     141d <main+0x20d>
lea    0xdb8(%rip),%r14
lea    0x60(%rsp),%rbx
lea    0xdb4(%rip),%r15
lea    0xdd1(%rip),%r12
jmp    136a <main+0x15a>
lea    0xdd5(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%r15
mov    0x2c9c(%rip),%r13
nopl   0x0(%rax)
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x200,%esi
call   1090 <fgets@plt>
test   %rax,%rax
je     141d <main+0x20d>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1120 <strstr@plt>
test   %rax,%rax
jne    1350 <main+0x140>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1120 <strstr@plt>
test   %rax,%rax
jne    1350 <main+0x140>
mov    %rbx,%rdi
call   1070 <tailstrip@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1060 <strrchr@plt>
test   %rax,%rax
je     1350 <main+0x140>
mov    %rax,%rbp
mov    %r15,%r13
add    $0x1,%rbp
mov    %rbp,%rdi
call   10c0 <modpath@plt>
lea    0xd29(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
lea    0x20(%rsp),%rsi
call   10d0 <split_path@plt>
mov    %eax,%ebp
lea    0xd18(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x3,%ebp
jl     1336 <main+0x126>
add    $0xffffffff,%ebp
mov    $0x1,%r15d
cs nopw 0x0(%rax,%rax,1)
mov    0x20(%rsp,%r15,8),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15
cmp    %r15,%rbp
jne    1400 <main+0x1f0>
jmp    1336 <main+0x126>
xor    %eax,%eax
call   10b0 <define_program_icons@plt>
xor    %eax,%eax
call   1130 <set_registry_entries@plt>
xor    %eax,%eax
add    $0x268,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b92(%rip),%rax
mov    (%rax),%edi
lea    0xbb1(%rip),%rsi
jmp    1458 <main+0x248>
lea    0xc16(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x2b6a(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>

LLVM IR (-O0):
@stdin = global i32 0
@stderr = global i32 0
@.str = [42 x i8] c"malformed MANIFEST: expected VERSION ...\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [9 x i8] c"%15s %7s\00"
@.str.2 = [4 x i8] c"x64\00"
@.str.3 = [55 x i8] c"Making installer script for gretl version %s (x64)...\0A\00"
@.str.4 = [58 x i8] c"malformed MANIFEST: if arch is present, it must be \22x64\22\0A\00"
@.str.5 = [49 x i8] c"Making installer script for gretl version %s...\0A\00"
@.str.6 = [10 x i8] c"\0A[Files]\0A\00"
@.str.7 = [8 x i8] c"VERSION\00"
@.str.8 = [5 x i8] c"DATE\00"
@.str.9 = [15 x i8] c"Source: \22%s\22; \00"
@.str.10 = [16 x i8] c"Destdir: \22{app}\00"
@.str.11 = [4 x i8] c"\\%s\00"
@.str.12 = [3 x i8] c"\22\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8 x i8*]
%7 = alloca [512 x i8]
%8 = alloca [16 x i8]
%9 = alloca [8 x i8]
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %11
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%15 = load i32, i32* @stdin
%16 = call i32* @fgets(i8* %14, i32 512, i32 %15)
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %23
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 @usage(i8* %21)
br label %23
23: ; preds = %18, %2
%24 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
%26 = icmp slt i32 %25, 11
br i1 %26, label %27, label %32
27: ; preds = %23
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %23
%33 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
store i8 0, i8* %33
%34 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
store i8 0, i8* %34
%35 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%36 = getelementptr inbounds i8, i8* %35, i64 8
%37 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%38 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%39 = call i32 @sscanf(i8* %36, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %37, i8* %38)
store i32 %39, i32* %13
%40 = load i32, i32* %13
%41 = icmp slt i32 %40, 1
br i1 %41, label %42, label %47
42: ; preds = %32
%43 = load i32, i32* @stderr
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%45 = load i32, i32* @EXIT_FAILURE
%46 = call i32 @exit(i32 %45)
unreachable
47: ; preds = %32
%48 = load i32, i32* %13
%49 = icmp eq i32 %48, 2
br i1 %49, label %50, label %64
50: ; preds = %47
%51 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%52 = call i32 @strcmp(i8* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%53 = icmp ne i32 %52, 0
br i1 %53, label %58, label %54
54: ; preds = %50
store i32 1, i32* %11
%55 = load i32, i32* @stderr
%56 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0), i8* %56)
br label %63
58: ; preds = %50
%59 = load i32, i32* @stderr
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
%61 = load i32, i32* @EXIT_FAILURE
%62 = call i32 @exit(i32 %61)
unreachable
63: ; preds = %54
br label %68
64: ; preds = %47
%65 = load i32, i32* @stderr
%66 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), i8* %66)
br label %68
68: ; preds = %64, %63
br label %69
69: ; preds = %68
%70 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%71 = load i32, i32* %11
%72 = call i32 @preamble(i8* %70, i32 %71)
%73 = call i32 (...) @add_languages()
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
br label %75
75: ; preds = %122, %96, %88, %69
%76 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%77 = load i32, i32* @stdin
%78 = call i32* @fgets(i8* %76, i32 512, i32 %77)
%79 = icmp ne i32* %78, null
br i1 %79, label %80, label %124
80: ; preds = %75
%81 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%82 = call i64 @strstr(i8* %81, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%83 = icmp ne i64 %82, 0
br i1 %83, label %88, label %84
84: ; preds = %80
%85 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%86 = call i64 @strstr(i8* %85, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%87 = icmp ne i64 %86, 0
br i1 %87, label %88, label %89
88: ; preds = %84, %80
br label %75
89: ; preds = %84
%90 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%91 = call i32 @tailstrip(i8* %90)
%92 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%93 = call i8* @strrchr(i8* %92, i8 signext 32)
store i8* %93, i8** %10
%94 = load i8*, i8** %10
%95 = icmp eq i8* %94, null
br i1 %95, label %96, label %97
96: ; preds = %89
br label %75
97: ; preds = %89
%98 = load i8*, i8** %10
%99 = getelementptr inbounds i8, i8* %98, i32 1
store i8* %99, i8** %10
%100 = load i8*, i8** %10
%101 = call i32 @modpath(i8* %100)
%102 = load i8*, i8** %10
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %102)
%104 = load i8*, i8** %10
%105 = getelementptr inbounds [8 x i8*], [8 x i8*]* %6, i64 0, i64 0
%106 = call i32 @split_path(i8* %104, i8** %105)
store i32 %106, i32* %13
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %12
br label %108
108: ; preds = %119, %97
%109 = load i32, i32* %12
%110 = load i32, i32* %13
%111 = sub nsw i32 %110, 1
%112 = icmp slt i32 %109, %111
br i1 %112, label %113, label %122
113: ; preds = %108
%114 = load i32, i32* %12
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [8 x i8*], [8 x i8*]* %6, i64 0, i64 %115
%117 = load i8*, i8** %116
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* %117)
br label %119
119: ; preds = %113
%120 = load i32, i32* %12
%121 = add nsw i32 %120, 1
store i32 %121, i32* %12
br label %108
122: ; preds = %108
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
br label %75
124: ; preds = %75
%125 = call i32 (...) @define_program_icons()
%126 = call i32 (...) @set_registry_entries()
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@stderr = global i32 0
@.str = [42 x i8] c"malformed MANIFEST: expected VERSION ...\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [9 x i8] c"%15s %7s\00"
@.str.2 = [4 x i8] c"x64\00"
@.str.3 = [55 x i8] c"Making installer script for gretl version %s (x64)...\0A\00"
@.str.4 = [58 x i8] c"malformed MANIFEST: if arch is present, it must be \22x64\22\0A\00"
@.str.5 = [49 x i8] c"Making installer script for gretl version %s...\0A\00"
@.str.7 = [8 x i8] c"VERSION\00"
@.str.8 = [5 x i8] c"DATE\00"
@.str.9 = [15 x i8] c"Source: \22%s\22; \00"
@.str.10 = [16 x i8] c"Destdir: \22{app}\00"
@.str.11 = [4 x i8] c"\\%s\00"
@str = [9 x i8] c"\0A[Files]\00"
@str.13 = [2 x i8] c"\22\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [8 x i8*]
%4 = alloca [512 x i8]
%5 = alloca [16 x i8]
%6 = alloca [8 x i8]
%7 = bitcast [8 x i8*]* %3 to i8*
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%11 = load i32, i32* @stdin
%12 = call i32* @fgets(i8* %8, i32 512, i32 %11)
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i8*, i8** %1
%16 = call i32 @usage(i8* %15)
br label %17
17: ; preds = %14, %2
%18 = call i32 @strlen(i8* %8)
%19 = icmp slt i32 %18, 11
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32, i32* @stderr
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %17
store i8 0, i8* %10
store i8 0, i8* %9
%26 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 8
%27 = call i32 @sscanf(i8* %26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %10)
%28 = icmp slt i32 %27, 1
br i1 %28, label %29, label %34
29: ; preds = %25
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%32 = load i32, i32* @EXIT_FAILURE
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %25
%35 = icmp eq i32 %27, 2
br i1 %35, label %36, label %46
36: ; preds = %34
%37 = call i32 @bcmp(i8* dereferenceable(4) %10, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 4)
%38 = icmp eq i32 %37, 0
%39 = load i32, i32* @stderr
br i1 %38, label %40, label %42
40: ; preds = %36
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0), i8* %9)
br label %49
42: ; preds = %36
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
%44 = load i32, i32* @EXIT_FAILURE
%45 = call i32 @exit(i32 %44)
unreachable
46: ; preds = %34
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), i8* %9)
br label %49
49: ; preds = %40, %46
%50 = phi i32 [ 1, %40 ], [ 0, %46 ]
%51 = call i32 @preamble(i8* %9, i32 %50)
%52 = call i32 (...) @add_languages()
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%54 = load i32, i32* @stdin
%55 = call i32* @fgets(i8* %8, i32 512, i32 %54)
%56 = icmp eq i32* %55, null
br i1 %56, label %92, label %57
57: ; preds = %49
%58 = getelementptr inbounds [8 x i8*], [8 x i8*]* %3, i64 0, i64 0
br label %59
59: ; preds = %57, %65
%60 = call i64 @strstr(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %59
%63 = call i64 @strstr(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %69, label %65
65: ; preds = %59, %62, %90, %69
%66 = load i32, i32* @stdin
%67 = call i32* @fgets(i8* %8, i32 512, i32 %66)
%68 = icmp eq i32* %67, null
br i1 %68, label %92, label %59
69: ; preds = %62
%70 = call i32 @tailstrip(i8* %8)
%71 = call i8* @strrchr(i8* %8, i8 signext 32)
%72 = icmp eq i8* %71, null
br i1 %72, label %65, label %73
73: ; preds = %69
%74 = getelementptr inbounds i8, i8* %71, i64 1
%75 = call i32 @modpath(i8* %74)
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %74)
%77 = call i32 @split_path(i8* %74, i8** %58)
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
%79 = icmp sgt i32 %77, 2
br i1 %79, label %80, label %90
80: ; preds = %73
%81 = add nsw i32 %77, -1
%82 = zext i32 %81 to i64
br label %83
83: ; preds = %80, %83
%84 = phi i64 [ 1, %80 ], [ %88, %83 ]
%85 = getelementptr inbounds [8 x i8*], [8 x i8*]* %3, i64 0, i64 %84
%86 = load i8*, i8** %85
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* %86)
%88 = add nuw nsw i64 %84, 1
%89 = icmp eq i64 %88, %82
br i1 %89, label %90, label %83
90: ; preds = %83, %73
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0))
br label %65
92: ; preds = %65, %49
%93 = call i32 (...) @define_program_icons()
%94 = call i32 (...) @set_registry_entries()
ret i32 0
}