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

/* Variables and functions */
scalar_t__ chdir(int /*<<< orphan*/);
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getenv(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ waitpid(int /*<<< orphan*/, int *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  char buf[1024];
  char *vec[8192];
  char *fvec[200];
  char **svec;
  char type[64];
  int i;
  int vp = 2;
  int ret = 0;
  pid_t pid;
  if (chdir(getenv("TOPDIR"))) {
    perror("chdir");
    exit(1);
  }
  vec[0] = "kernel-doc";
  vec[1] = "-docbook";
  for (i = 1; vp < 8189; i++) {
    if (argv[i] == NULL)
      break;
    vec[vp++] = type;
    vec[vp++] = argv[i];
  }
  vec[vp++] = buf + 2;
  vec[vp++] = NULL;
  while (fgets(buf, 1024, stdin)) {
    if (*buf != '!') {
      printf("%s", buf);
      continue;
    }
    fflush(stdout);
    svec = vec;
    if (buf[1] == 'E')
      strcpy(type, "-function");
    else if (buf[1] == 'I')
      strcpy(type, "-nofunction");
    else if (buf[1] == 'F') {
      int snarf = 0;
      fvec[0] = "kernel-doc";
      fvec[1] = "-docbook";
      strcpy(type, "-function");
      vp = 2;
      for (i = 2; buf[i]; i++) {
        if (buf[i] == ' ' || buf[i] == '\n') {
          buf[i] = '\0';
          snarf = 1;
          continue;
        }
        if (snarf) {
          snarf = 0;
          fvec[vp++] = type;
          fvec[vp++] = &buf[i];
        }
      }
      fvec[vp++] = &buf[2];
      fvec[vp] = NULL;
      svec = fvec;
    } else {
      fprintf(stderr, "Unknown ! escape.\n");
      exit(1);
    }
    switch (pid = fork()) {
    case -1:
      perror("fork");
      exit(1);
    case 0:
      execvp("scripts/kernel-doc", svec);
      perror("exec scripts/kernel-doc");
      exit(1);
    default:
      waitpid(pid, &ret, 0);
    }
  }
  exit(ret);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10ac0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2,-0x10aa8(%rbp)
movl   $0x0,-0x10aac(%rbp)
lea    0xe0c(%rip),%rdi
call   1030 <getenv@plt>
mov    %eax,%edi
call   1050 <chdir@plt>
cmp    $0x0,%rax
je     1220 <main+0x60>
lea    0xdf6(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xe2d(%rip),%rax
mov    %rax,-0x10410(%rbp)
lea    0xdd8(%rip),%rax
mov    %rax,-0x10408(%rbp)
movl   $0x1,-0x10aa4(%rbp)
cmpl   $0x1ffd,-0x10aa8(%rbp)
jge    12d1 <main+0x111>
mov    -0x10(%rbp),%rax
movslq -0x10aa4(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1271 <main+0xb1>
jmp    12d1 <main+0x111>
lea    -0x10aa0(%rbp),%rcx
mov    -0x10aa8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10aa8(%rbp)
cltq
mov    %rcx,-0x10410(%rbp,%rax,8)
ff
mov    -0x10(%rbp),%rax
movslq -0x10aa4(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x10aa8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10aa8(%rbp)
cltq
mov    %rcx,-0x10410(%rbp,%rax,8)
ff
mov    -0x10aa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10aa4(%rbp)
jmp    1246 <main+0x86>
lea    -0x410(%rbp),%rcx
add    $0x2,%rcx
mov    -0x10aa8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10aa8(%rbp)
cltq
mov    %rcx,-0x10410(%rbp,%rax,8)
ff
mov    -0x10aa8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10aa8(%rbp)
cltq
movq   $0x0,-0x10410(%rbp,%rax,8)
lea    -0x410(%rbp),%rdi
mov    0x2cc4(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     160f <main+0x44f>
movsbl -0x410(%rbp),%eax
cmp    $0x21,%eax
je     1362 <main+0x1a2>
lea    -0x410(%rbp),%rsi
lea    0xcbe(%rip),%rdi
call   1060 <printf@plt>
jmp    1316 <main+0x156>
mov    0x2c67(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
lea    -0x10410(%rbp),%rax
mov    %rax,-0x10a58(%rbp)
movsbl -0x40f(%rbp),%eax
cmp    $0x45,%eax
jne    13a6 <main+0x1e6>
lea    -0x10aa0(%rbp),%rdi
lea    0xc7d(%rip),%rsi
call   1040 <strcpy@plt>
jmp    1581 <main+0x3c1>
movsbl -0x40f(%rbp),%eax
cmp    $0x49,%eax
jne    13ce <main+0x20e>
lea    -0x10aa0(%rbp),%rdi
lea    0xc5f(%rip),%rsi
call   1040 <strcpy@plt>
jmp    157c <main+0x3bc>
movsbl -0x40f(%rbp),%eax
cmp    $0x46,%eax
jne    1558 <main+0x398>
movl   $0x0,-0x10ab4(%rbp)
lea    0xc65(%rip),%rax
mov    %rax,-0x10a50(%rbp)
lea    0xc10(%rip),%rax
mov    %rax,-0x10a48(%rbp)
lea    -0x10aa0(%rbp),%rdi
lea    0xc07(%rip),%rsi
call   1040 <strcpy@plt>
movl   $0x2,-0x10aa8(%rbp)
movl   $0x2,-0x10aa4(%rbp)
movslq -0x10aa4(%rbp),%rax
cmpb   $0x0,-0x410(%rbp,%rax,1)
je     150c <main+0x34c>
movslq -0x10aa4(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
je     1470 <main+0x2b0>
movslq -0x10aa4(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    148e <main+0x2ce>
movslq -0x10aa4(%rbp),%rax
movb   $0x0,-0x410(%rbp,%rax,1)
movl   $0x1,-0x10ab4(%rbp)
jmp    14f8 <main+0x338>
cmpl   $0x0,-0x10ab4(%rbp)
je     14f3 <main+0x333>
movl   $0x0,-0x10ab4(%rbp)
lea    -0x10aa0(%rbp),%rcx
mov    -0x10aa8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10aa8(%rbp)
cltq
mov    %rcx,-0x10a50(%rbp,%rax,8)
ff
movslq -0x10aa4(%rbp),%rax
lea    -0x410(%rbp),%rcx
add    %rax,%rcx
mov    -0x10aa8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10aa8(%rbp)
cltq
mov    %rcx,-0x10a50(%rbp,%rax,8)
ff
jmp    14f8 <main+0x338>
mov    -0x10aa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10aa4(%rbp)
jmp    142b <main+0x26b>
lea    -0x410(%rbp),%rcx
add    $0x2,%rcx
mov    -0x10aa8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10aa8(%rbp)
cltq
mov    %rcx,-0x10a50(%rbp,%rax,8)
ff
movslq -0x10aa8(%rbp),%rax
movq   $0x0,-0x10a50(%rbp,%rax,8)
lea    -0x10a50(%rbp),%rax
mov    %rax,-0x10a58(%rbp)
jmp    1577 <main+0x3b7>
mov    0x2a79(%rip),%rax
mov    (%rax),%edi
lea    0xac7(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    157c <main+0x3bc>
jmp    1581 <main+0x3c1>
xor    %eax,%eax
call   10e0 <fork@plt>
mov    %eax,-0x10ab0(%rbp)
mov    %eax,%ecx
mov    %ecx,-0x10ab8(%rbp)
sub    $0xffffffff,%eax
je     15b7 <main+0x3f7>
jmp    15a4 <main+0x3e4>
mov    -0x10ab8(%rbp),%eax
test   %eax,%eax
je     15cd <main+0x40d>
jmp    15f6 <main+0x436>
lea    0xa84(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10a58(%rbp),%rsi
lea    0xa71(%rip),%rdi
call   10c0 <execvp@plt>
lea    0xa60(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10ab0(%rbp),%edi
lea    -0x10aac(%rbp),%rsi
xor    %edx,%edx
call   10a0 <waitpid@plt>
jmp    1316 <main+0x156>
mov    -0x10aac(%rbp),%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10a98,%rsp
mov    %rsi,%rbp
movl   $0x0,0xc(%rsp)
lea    0xe1d(%rip),%rdi
call   1030 <getenv@plt>
mov    %eax,%edi
call   1050 <chdir@plt>
test   %rax,%rax
jne    1267 <main+0xa7>
lea    0xe59(%rip),%rax
mov    %rax,0xa90(%rsp)
lea    0xe03(%rip),%rax
mov    %rax,0xa98(%rsp)
xor    %eax,%eax
lea    0x10(%rsp),%rbx
nopl   0x0(%rax)
mov    0x8(%rbp,%rax,4),%rcx
test   %rcx,%rcx
je     127d <main+0xbd>
mov    %rbx,0xaa0(%rsp,%rax,8)
mov    %rcx,0xaa8(%rsp,%rax,8)
mov    0x10(%rbp,%rax,4),%rcx
test   %rcx,%rcx
je     1283 <main+0xc3>
mov    %rbx,0xab0(%rsp,%rax,8)
mov    %rcx,0xab8(%rsp,%rax,8)
add    $0x4,%rax
cmp    $0x1ffc,%rax
jne    1220 <main+0x60>
mov    $0x1ffe,%eax
jmp    1287 <main+0xc7>
lea    0xd99(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
add    $0x2,%rax
jmp    1287 <main+0xc7>
add    $0x4,%rax
lea    0x52(%rsp),%rdx
mov    %eax,%ecx
or     $0x1,%eax
mov    %rdx,0xa90(%rsp,%rcx,8)
movq   $0x0,0xa90(%rsp,%rax,8)
mov    0x2d3c(%rip),%r12
mov    (%r12),%edx
lea    0x50(%rsp),%rdi
mov    $0x400,%esi
call   1070 <fgets@plt>
xor    %edi,%edi
test   %rax,%rax
je     1425 <main+0x265>
lea    0xc(%rsp),%r15
lea    0x50(%rsp),%r13
lea    0xd3b(%rip),%rbp
jmp    1305 <main+0x145>
nopl   (%rax)
mov    %rbp,%rdi
mov    %r13,%rsi
call   1060 <printf@plt>
mov    (%r12),%edx
mov    %r13,%rdi
mov    $0x400,%esi
call   1070 <fgets@plt>
test   %rax,%rax
je     1421 <main+0x261>
cmpb   $0x21,0x50(%rsp)
jne    12e0 <main+0x120>
mov    0x2cbd(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    0x51(%rsp),%al
cmp    $0x49,%al
je     133a <main+0x17a>
cmp    $0x46,%al
je     1356 <main+0x196>
cmp    $0x45,%al
jne    1451 <main+0x291>
mov    %rbx,%rdi
lea    0xce1(%rip),%rsi
jmp    1344 <main+0x184>
mov    %rbx,%rdi
lea    0xcdf(%rip),%rsi
call   1040 <strcpy@plt>
lea    0xa90(%rsp),%r14
jmp    1400 <main+0x240>
lea    0xcf7(%rip),%rax
mov    %rax,0x450(%rsp)
lea    0xca1(%rip),%rax
mov    %rax,0x458(%rsp)
mov    %rbx,%rdi
lea    0xc9b(%rip),%rsi
call   1040 <strcpy@plt>
xor    %esi,%esi
mov    $0x2,%eax
lea    0x52(%rsp),%rcx
jmp    13ae <main+0x1ee>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rcx)
mov    $0x1,%edx
add    $0x1,%rcx
mov    %edx,%esi
movzbl (%rcx),%edx
cmp    $0xa,%dl
je     13a0 <main+0x1e0>
cmp    $0x20,%dl
je     13a0 <main+0x1e0>
test   %dl,%dl
je     13dd <main+0x21d>
xor    %edx,%edx
test   %esi,%esi
je     13a8 <main+0x1e8>
movslq %eax,%rsi
mov    %rbx,0x450(%rsp,%rsi,8)
add    $0x2,%eax
mov    %rcx,0x458(%rsp,%rsi,8)
jmp    13a8 <main+0x1e8>
cltq
lea    0x52(%rsp),%rcx
mov    %rcx,0x450(%rsp,%rax,8)
movq   $0x0,0x458(%rsp,%rax,8)
lea    0x450(%rsp),%r14
xor    %eax,%eax
call   10e0 <fork@plt>
test   %eax,%eax
je     142a <main+0x26a>
cmp    $0xffffffff,%eax
je     1445 <main+0x285>
mov    %eax,%edi
mov    %r15,%rsi
xor    %edx,%edx
call   10a0 <waitpid@plt>
jmp    12eb <main+0x12b>
mov    0xc(%rsp),%edi
call   10d0 <exit@plt>
lea    0xc1b(%rip),%rdi
mov    %r14,%rsi
call   10c0 <execvp@plt>
lea    0xc07(%rip),%rdi
jmp    126e <main+0xae>
lea    0xbf6(%rip),%rdi
jmp    126e <main+0xae>
mov    0x2b80(%rip),%rax
mov    (%rax),%edi
lea    0xbce(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"TOPDIR\00"
@.str.1 = [6 x i8] c"chdir\00"
@.str.2 = [11 x i8] c"kernel-doc\00"
@.str.3 = [9 x i8] c"-docbook\00"
@stdin = global i32 0
@.str.4 = [3 x i8] c"%s\00"
@stdout = global i32 0
@.str.5 = [10 x i8] c"-function\00"
@.str.6 = [12 x i8] c"-nofunction\00"
@stderr = global i32 0
@.str.7 = [19 x i8] c"Unknown ! escape.\0A\00"
@.str.8 = [5 x i8] c"fork\00"
@.str.9 = [19 x i8] c"scripts/kernel-doc\00"
@.str.10 = [24 x i8] c"exec scripts/kernel-doc\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca [8192 x i8*]
%8 = alloca [200 x i8*]
%9 = alloca i8**
%10 = alloca [64 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 2, i32* %12
store i32 0, i32* %13
%16 = call i32 @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%17 = call i64 @chdir(i32 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %7, i64 0, i64 0
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %23
%24 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %7, i64 0, i64 1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %24
store i32 1, i32* %11
br label %25
25: ; preds = %51, %22
%26 = load i32, i32* %12
%27 = icmp slt i32 %26, 8189
br i1 %27, label %28, label %54
28: ; preds = %25
%29 = load i8**, i8*** %5
%30 = load i32, i32* %11
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = icmp eq i8* %33, null
br i1 %34, label %35, label %36
35: ; preds = %28
br label %54
36: ; preds = %28
%37 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%38 = load i32, i32* %12
%39 = add nsw i32 %38, 1
store i32 %39, i32* %12
%40 = sext i32 %38 to i64
%41 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %7, i64 0, i64 %40
store i8* %37, i8** %41
%42 = load i8**, i8*** %5
%43 = load i32, i32* %11
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %42, i64 %44
%46 = load i8*, i8** %45
%47 = load i32, i32* %12
%48 = add nsw i32 %47, 1
store i32 %48, i32* %12
%49 = sext i32 %47 to i64
%50 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %7, i64 0, i64 %49
store i8* %46, i8** %50
br label %51
51: ; preds = %36
%52 = load i32, i32* %11
%53 = add nsw i32 %52, 1
store i32 %53, i32* %11
br label %25
54: ; preds = %35, %25
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%56 = getelementptr inbounds i8, i8* %55, i64 2
%57 = load i32, i32* %12
%58 = add nsw i32 %57, 1
store i32 %58, i32* %12
%59 = sext i32 %57 to i64
%60 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %7, i64 0, i64 %59
store i8* %56, i8** %60
%61 = load i32, i32* %12
%62 = add nsw i32 %61, 1
store i32 %62, i32* %12
%63 = sext i32 %61 to i64
%64 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %7, i64 0, i64 %63
store i8* null, i8** %64
br label %65
65: ; preds = %180, %75, %54
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%67 = load i32, i32* @stdin
%68 = call i64 @fgets(i8* %66, i32 1024, i32 %67)
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %181
70: ; preds = %65
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = icmp ne i32 %73, 33
br i1 %74, label %75, label %78
75: ; preds = %70
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%77 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %76)
br label %65
78: ; preds = %70
%79 = load i32, i32* @stdout
%80 = call i32 @fflush(i32 %79)
%81 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %7, i64 0, i64 0
store i8** %81, i8*** %9
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 1
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 69
br i1 %85, label %86, label %89
86: ; preds = %78
%87 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%88 = call i32 @strcpy(i8* %87, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %167
89: ; preds = %78
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 1
%91 = load i8, i8* %90
%92 = sext i8 %91 to i32
%93 = icmp eq i32 %92, 73
br i1 %93, label %94, label %97
94: ; preds = %89
%95 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%96 = call i32 @strcpy(i8* %95, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %166
97: ; preds = %89
%98 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 1
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = icmp eq i32 %100, 70
br i1 %101, label %102, label %161
102: ; preds = %97
store i32 0, i32* %15
%103 = getelementptr inbounds [200 x i8*], [200 x i8*]* %8, i64 0, i64 0
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %103
%104 = getelementptr inbounds [200 x i8*], [200 x i8*]* %8, i64 0, i64 1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %104
%105 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%106 = call i32 @strcpy(i8* %105, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
store i32 2, i32* %12
store i32 2, i32* %11
br label %107
107: ; preds = %148, %102
%108 = load i32, i32* %11
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %109
%111 = load i8, i8* %110
%112 = icmp ne i8 %111, 0
br i1 %112, label %113, label %151
113: ; preds = %107
%114 = load i32, i32* %11
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %115
%117 = load i8, i8* %116
%118 = sext i8 %117 to i32
%119 = icmp eq i32 %118, 32
br i1 %119, label %127, label %120
120: ; preds = %113
%121 = load i32, i32* %11
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %122
%124 = load i8, i8* %123
%125 = sext i8 %124 to i32
%126 = icmp eq i32 %125, 10
br i1 %126, label %127, label %131
127: ; preds = %120, %113
%128 = load i32, i32* %11
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %129
store i8 0, i8* %130
store i32 1, i32* %15
br label %148
131: ; preds = %120
%132 = load i32, i32* %15
%133 = icmp ne i32 %132, 0
br i1 %133, label %134, label %147
134: ; preds = %131
store i32 0, i32* %15
%135 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%136 = load i32, i32* %12
%137 = add nsw i32 %136, 1
store i32 %137, i32* %12
%138 = sext i32 %136 to i64
%139 = getelementptr inbounds [200 x i8*], [200 x i8*]* %8, i64 0, i64 %138
store i8* %135, i8** %139
%140 = load i32, i32* %11
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %141
%143 = load i32, i32* %12
%144 = add nsw i32 %143, 1
store i32 %144, i32* %12
%145 = sext i32 %143 to i64
%146 = getelementptr inbounds [200 x i8*], [200 x i8*]* %8, i64 0, i64 %145
store i8* %142, i8** %146
br label %147
147: ; preds = %134, %131
br label %148
148: ; preds = %147, %127
%149 = load i32, i32* %11
%150 = add nsw i32 %149, 1
store i32 %150, i32* %11
br label %107
151: ; preds = %107
%152 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 2
%153 = load i32, i32* %12
%154 = add nsw i32 %153, 1
store i32 %154, i32* %12
%155 = sext i32 %153 to i64
%156 = getelementptr inbounds [200 x i8*], [200 x i8*]* %8, i64 0, i64 %155
store i8* %152, i8** %156
%157 = load i32, i32* %12
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds [200 x i8*], [200 x i8*]* %8, i64 0, i64 %158
store i8* null, i8** %159
%160 = getelementptr inbounds [200 x i8*], [200 x i8*]* %8, i64 0, i64 0
store i8** %160, i8*** %9
br label %165
161: ; preds = %97
%162 = load i32, i32* @stderr
%163 = call i32 @fprintf(i32 %162, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%164 = call i32 @exit(i32 1)
unreachable
165: ; preds = %151
br label %166
166: ; preds = %165, %94
br label %167
167: ; preds = %166, %86
%168 = call i32 (...) @fork()
store i32 %168, i32* %14
switch i32 %168, label %177 [
i32 -1, label %169
i32 0, label %172
]
169: ; preds = %167
%170 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%171 = call i32 @exit(i32 1)
unreachable
172: ; preds = %167
%173 = load i8**, i8*** %9
%174 = call i32 @execvp(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i8** %173)
%175 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
%176 = call i32 @exit(i32 1)
unreachable
177: ; preds = %167
%178 = load i32, i32* %14
%179 = call i32 @waitpid(i32 %178, i32* %13, i32 0)
br label %180
180: ; preds = %177
br label %65
181: ; preds = %65
%182 = load i32, i32* %13
%183 = call i32 @exit(i32 %182)
unreachable
}

LLVM IR (-O2):
@.str = [7 x i8] c"TOPDIR\00"
@.str.1 = [6 x i8] c"chdir\00"
@.str.2 = [11 x i8] c"kernel-doc\00"
@.str.3 = [9 x i8] c"-docbook\00"
@stdin = global i32 0
@.str.4 = [3 x i8] c"%s\00"
@stdout = global i32 0
@.str.5 = [10 x i8] c"-function\00"
@.str.6 = [12 x i8] c"-nofunction\00"
@stderr = global i32 0
@.str.7 = [19 x i8] c"Unknown ! escape.\0A\00"
@.str.8 = [5 x i8] c"fork\00"
@.str.9 = [19 x i8] c"scripts/kernel-doc\00"
@.str.10 = [24 x i8] c"exec scripts/kernel-doc\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [8192 x i8*]
%5 = alloca [200 x i8*]
%6 = alloca [64 x i8]
%7 = alloca i32
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = bitcast [8192 x i8*]* %4 to i8*
%10 = bitcast [200 x i8*]* %5 to i8*
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%12 = bitcast i32* %7 to i8*
store i32 0, i32* %7
%13 = tail call i32 @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%14 = tail call i64 @chdir(i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %2
%17 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %4, i64 0, i64 0
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %20
%21 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %4, i64 0, i64 1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %21
br label %22
22: ; preds = %37, %19
%23 = phi i64 [ 1, %19 ], [ %42, %37 ]
%24 = phi i64 [ 2, %19 ], [ %40, %37 ]
%25 = getelementptr inbounds i8*, i8** %1, i64 %23
%26 = load i8*, i8** %25
%27 = icmp eq i8* %26, null
br i1 %27, label %44, label %28
28: ; preds = %22
%29 = or i64 %24, 1
%30 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %4, i64 0, i64 %24
store i8* %11, i8** %30
%31 = add nuw nsw i64 %24, 2
%32 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %4, i64 0, i64 %29
store i8* %26, i8** %32
%33 = add nuw nsw i64 %23, 1
%34 = getelementptr inbounds i8*, i8** %1, i64 %33
%35 = load i8*, i8** %34
%36 = icmp eq i8* %35, null
br i1 %36, label %44, label %37
37: ; preds = %28
%38 = or i64 %31, 1
%39 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %4, i64 0, i64 %31
store i8* %11, i8** %39
%40 = add nuw nsw i64 %24, 4
%41 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %4, i64 0, i64 %38
store i8* %35, i8** %41
%42 = add nuw nsw i64 %23, 2
%43 = icmp eq i64 %42, 4095
br i1 %43, label %47, label %22
44: ; preds = %28, %22
%45 = phi i64 [ %24, %22 ], [ %31, %28 ]
%46 = trunc i64 %45 to i32
br label %47
47: ; preds = %37, %44
%48 = phi i32 [ %46, %44 ], [ 8190, %37 ]
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 2
%50 = or i32 %48, 1
%51 = zext i32 %48 to i64
%52 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %4, i64 0, i64 %51
store i8* %49, i8** %52
%53 = zext i32 %50 to i64
%54 = getelementptr inbounds [8192 x i8*], [8192 x i8*]* %4, i64 0, i64 %53
store i8* null, i8** %54
%55 = load i32, i32* @stdin
%56 = call i64 @fgets(i8* %8, i32 1024, i32 %55)
%57 = icmp eq i64 %56, 0
br i1 %57, label %125, label %58
58: ; preds = %47
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1
%60 = getelementptr inbounds [200 x i8*], [200 x i8*]* %5, i64 0, i64 0
%61 = getelementptr inbounds [200 x i8*], [200 x i8*]* %5, i64 0, i64 1
br label %62
62: ; preds = %58, %67
%63 = load i8, i8* %8
%64 = icmp eq i8 %63, 33
br i1 %64, label %71, label %65
65: ; preds = %62
%66 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %8)
br label %67
67: ; preds = %65, %121
%68 = load i32, i32* @stdin
%69 = call i64 @fgets(i8* %8, i32 1024, i32 %68)
%70 = icmp eq i64 %69, 0
br i1 %70, label %123, label %62
71: ; preds = %62
%72 = load i32, i32* @stdout
%73 = call i32 @fflush(i32 %72)
%74 = load i8, i8* %59
switch i8 %74, label %107 [
i8 69, label %75
i8 73, label %77
i8 70, label %79
]
75: ; preds = %71
%76 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %111
77: ; preds = %71
%78 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %111
79: ; preds = %71
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %60
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %61
%80 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %81
81: ; preds = %97, %79
%82 = phi i64 [ %100, %97 ], [ 2, %79 ]
%83 = phi i32 [ %98, %97 ], [ 2, %79 ]
%84 = phi i32 [ %99, %97 ], [ 0, %79 ]
%85 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %82
%86 = load i8, i8* %85
switch i8 %86, label %88 [
i8 0, label %101
i8 32, label %87
i8 10, label %87
]
87: ; preds = %81, %81
store i8 0, i8* %85
br label %97
88: ; preds = %81
%89 = icmp eq i32 %84, 0
br i1 %89, label %97, label %90
90: ; preds = %88
%91 = add nsw i32 %83, 1
%92 = sext i32 %83 to i64
%93 = getelementptr inbounds [200 x i8*], [200 x i8*]* %5, i64 0, i64 %92
store i8* %11, i8** %93
%94 = add nsw i32 %83, 2
%95 = sext i32 %91 to i64
%96 = getelementptr inbounds [200 x i8*], [200 x i8*]* %5, i64 0, i64 %95
store i8* %85, i8** %96
br label %97
97: ; preds = %88, %90, %87
%98 = phi i32 [ %83, %87 ], [ %94, %90 ], [ %83, %88 ]
%99 = phi i32 [ 1, %87 ], [ 0, %90 ], [ 0, %88 ]
%100 = add nuw i64 %82, 1
br label %81
101: ; preds = %81
%102 = add nsw i32 %83, 1
%103 = sext i32 %83 to i64
%104 = getelementptr inbounds [200 x i8*], [200 x i8*]* %5, i64 0, i64 %103
store i8* %49, i8** %104
%105 = sext i32 %102 to i64
%106 = getelementptr inbounds [200 x i8*], [200 x i8*]* %5, i64 0, i64 %105
store i8* null, i8** %106
br label %111
107: ; preds = %71
%108 = load i32, i32* @stderr
%109 = call i32 @fprintf(i32 %108, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%110 = call i32 @exit(i32 1)
unreachable
111: ; preds = %77, %101, %75
%112 = phi i8** [ %20, %75 ], [ %20, %77 ], [ %60, %101 ]
%113 = call i32 (...) @fork()
switch i32 %113, label %121 [
i32 -1, label %114
i32 0, label %117
]
114: ; preds = %111
%115 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%116 = call i32 @exit(i32 1)
unreachable
117: ; preds = %111
%118 = call i32 @execvp(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i8** %112)
%119 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
%120 = call i32 @exit(i32 1)
unreachable
121: ; preds = %111
%122 = call i32 @waitpid(i32 %113, i32* %7, i32 0)
br label %67
123: ; preds = %67
%124 = load i32, i32* %7
br label %125
125: ; preds = %123, %47
%126 = phi i32 [ %124, %123 ], [ 0, %47 ]
%127 = call i32 @exit(i32 %126)
unreachable
}