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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
scalar_t__ strncmp(char *, char *, int);
char *strstr(char *, char *);
int main(int argc, char **argv) {
  if (argc != 2) {
    printf(
        "usage: %s /media/ubuntu/usr/include/x86_64-linux-gnu/bits/syscall.h\n",
        argv[0]);
    return 1;
  }
  FILE *fp = fopen(argv[1], "r");
  if (!fp) {
    fprintf(stderr, "Error: cannot open file\n");
    return 1;
  }
  char buf[4096];
  while (fgets(buf, 4096, fp)) {
    char *start = buf;
    while (*start == ' ' || *start == '\t')
      start++;
    char *end = strchr(start, '\n');
    if (end)
      *end = '\0';
    if (strncmp(start, "#endif", 6) == 0)
      printf("%s\n", start);
    if (strncmp(start, "#endif", 6) == 0)
      printf("%s\n", start);
    else if (strncmp(start, "#if", 3) == 0)
      printf("%s\n", start);
    else if (strncmp(start, "#define", 7) == 0) {
      char *ptr1 = strstr(start, "SYS_");
      char *ptr2 = strstr(start, "__NR_");
      if (!ptr1 || !ptr2) {
        fprintf(stderr, "Error: cannot parse \"%s\"\n", start);
        fclose(fp);
        return 1;
      }
      *(ptr2 - 1) = '\0';
      char *ptr3 = ptr1;
      while (*ptr3 != ' ' && *ptr3 != '\t' && *ptr3 != '\0')
        ptr3++;
      *ptr3 = '\0';
      ptr3 = ptr2;
      while (*ptr3 != ' ' && *ptr3 != '\t' && *ptr3 != '\0')
        ptr3++;
      *ptr3 = '\0';
      ptr3 = ptr1;
      while (*ptr3 != '_')
        ptr3++;
      ptr3++;
      printf("#ifdef %s\n", ptr1);
      printf("#ifdef %s\n", ptr2);
      printf("\t{\"%s\", %s},\n", ptr3, ptr2);
      printf("#endif\n");
      printf("#endif\n");
    }
  }
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1050,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11c4 <main+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    160d <main+0x48d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe72(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    120a <main+0x8a>
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
lea    0xe50(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    160d <main+0x48d>
jmp    120f <main+0x8f>
lea    -0x1020(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x1000,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     15fd <main+0x47d>
lea    -0x1020(%rbp),%rax
mov    %rax,-0x1028(%rbp)
mov    -0x1028(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x1049(%rbp)
je     126d <main+0xed>
mov    -0x1028(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x1049(%rbp)
mov    -0x1049(%rbp),%al
test   $0x1,%al
jne    1280 <main+0x100>
jmp    1297 <main+0x117>
mov    -0x1028(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1028(%rbp)
jmp    123c <main+0xbc>
mov    -0x1028(%rbp),%rdi
mov    $0xa,%esi
call   1050 <strchr@plt>
mov    %rax,-0x1030(%rbp)
cmpq   $0x0,-0x1030(%rbp)
je     12c7 <main+0x147>
mov    -0x1030(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x1028(%rbp),%rdi
lea    0xd8b(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    12fe <main+0x17e>
mov    -0x1028(%rbp),%rsi
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x1028(%rbp),%rdi
lea    0xd54(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    133a <main+0x1ba>
mov    -0x1028(%rbp),%rsi
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    15f8 <main+0x478>
mov    -0x1028(%rbp),%rdi
lea    0xd1f(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1376 <main+0x1f6>
mov    -0x1028(%rbp),%rsi
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    15f3 <main+0x473>
mov    -0x1028(%rbp),%rdi
lea    0xce7(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    15ee <main+0x46e>
mov    -0x1028(%rbp),%rdi
lea    0xccd(%rip),%rsi
call   10a0 <strstr@plt>
mov    %rax,-0x1038(%rbp)
mov    -0x1028(%rbp),%rdi
lea    0xcb8(%rip),%rsi
call   10a0 <strstr@plt>
mov    %rax,-0x1040(%rbp)
cmpq   $0x0,-0x1038(%rbp)
je     13e8 <main+0x268>
cmpq   $0x0,-0x1040(%rbp)
jne    141b <main+0x29b>
mov    0x2bf1(%rip),%rax
mov    (%rax),%edi
mov    -0x1028(%rbp),%rdx
lea    0xc7f(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    160d <main+0x48d>
mov    -0x1040(%rbp),%rax
movb   $0x0,-0x1(%rax)
mov    -0x1038(%rbp),%rax
mov    %rax,-0x1048(%rbp)
mov    -0x1048(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x104a(%rbp)
je     1480 <main+0x300>
mov    -0x1048(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0x104a(%rbp)
je     1480 <main+0x300>
mov    -0x1048(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x104a(%rbp)
mov    -0x104a(%rbp),%al
test   $0x1,%al
jne    1493 <main+0x313>
jmp    14aa <main+0x32a>
mov    -0x1048(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1048(%rbp)
jmp    1434 <main+0x2b4>
mov    -0x1048(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x1040(%rbp),%rax
mov    %rax,-0x1048(%rbp)
mov    -0x1048(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x104b(%rbp)
je     150e <main+0x38e>
mov    -0x1048(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0x104b(%rbp)
je     150e <main+0x38e>
mov    -0x1048(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x104b(%rbp)
mov    -0x104b(%rbp),%al
test   $0x1,%al
jne    1521 <main+0x3a1>
jmp    1538 <main+0x3b8>
mov    -0x1048(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1048(%rbp)
jmp    14c2 <main+0x342>
mov    -0x1048(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x1038(%rbp),%rax
mov    %rax,-0x1048(%rbp)
mov    -0x1048(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     157a <main+0x3fa>
mov    -0x1048(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1048(%rbp)
jmp    1550 <main+0x3d0>
mov    -0x1048(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1048(%rbp)
mov    -0x1038(%rbp),%rsi
lea    0xafe(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x1040(%rbp),%rsi
lea    0xae9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x1048(%rbp),%rsi
mov    -0x1040(%rbp),%rdx
lea    0xad8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xad8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xaca(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    15f3 <main+0x473>
jmp    15f8 <main+0x478>
jmp    120f <main+0x8f>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1050,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1018,%rsp
cmp    $0x2,%edi
jne    13d0 <main+0x240>
mov    0x8(%rsi),%rdi
lea    0xe90(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     13e3 <main+0x253>
mov    %rax,%rbx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x1000,%esi
mov    %rax,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     13c4 <main+0x234>
lea    0xebf(%rip),%r15
lea    0xe6e(%rip),%r12
lea    0xe6b(%rip),%r13
mov    %rbp,%r14
mov    %rbx,0x8(%rsp)
jmp    1214 <main+0x84>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r14
mov    (%r14),%al
cmp    $0x20,%al
je     1210 <main+0x80>
cmp    $0x9,%al
je     1210 <main+0x80>
mov    %r14,%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1234 <main+0xa4>
movb   $0x0,(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1251 <main+0xc1>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     13a0 <main+0x210>
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     13a0 <main+0x210>
mov    %r14,%rdi
mov    %r13,%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    13a8 <main+0x218>
mov    %r12,%rbx
mov    %r14,%rdi
lea    0xdc3(%rip),%rsi
call   10b0 <strstr@plt>
mov    %rax,%r12
mov    %r14,%rdi
lea    0xdb6(%rip),%rsi
call   10b0 <strstr@plt>
test   %r12,%r12
je     1413 <main+0x283>
mov    %rax,%r13
test   %rax,%rax
je     1413 <main+0x283>
movb   $0x0,-0x1(%r13)
mov    %r12,%rax
movabs $0x100000201,%rdx
jmp    12f4 <main+0x164>
nopl   0x0(%rax)
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%rcx
ja     12f0 <main+0x160>
bt     %rcx,%rdx
jae    12f0 <main+0x160>
movb   $0x0,(%rax)
mov    %r13,%rax
jmp    1314 <main+0x184>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%rcx
ja     1310 <main+0x180>
bt     %rcx,%rdx
jae    1310 <main+0x180>
movb   $0x0,(%rax)
mov    %r12,%rbp
nopl   0x0(%rax)
cmpb   $0x5f,0x0(%rbp)
lea    0x1(%rbp),%rbp
jne    1330 <main+0x1a0>
lea    0xd50(%rip),%r14
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd3a(%rip),%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rbp
mov    %rbx,%r12
mov    0x8(%rsp),%rbx
lea    0xcd1(%rip),%r13
jmp    13a8 <main+0x218>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
mov    $0x1000,%esi
mov    %rbx,%rdx
call   1080 <fgets@plt>
mov    %rbp,%r14
test   %rax,%rax
jne    1214 <main+0x84>
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1050 <fclose@plt>
jmp    13ff <main+0x26f>
mov    (%rsi),%rsi
lea    0xc26(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    13fa <main+0x26a>
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
lea    0xc54(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x1018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bc6(%rip),%rax
mov    (%rax),%edi
lea    0xc54(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%ebp
mov    0x8(%rsp),%rbx
jmp    13c6 <main+0x236>

LLVM IR (-O0):
@.str = [69 x i8] c"usage: %s /media/ubuntu/usr/include/x86_64-linux-gnu/bits/syscall.h\0A\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [25 x i8] c"Error: cannot open file\0A\00"
@.str.3 = [7 x i8] c"#endif\00"
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [4 x i8] c"#if\00"
@.str.6 = [8 x i8] c"#define\00"
@.str.7 = [5 x i8] c"SYS_\00"
@.str.8 = [6 x i8] c"__NR_\00"
@.str.9 = [26 x i8] c"Error: cannot parse \22%s\22\0A\00"
@.str.10 = [11 x i8] c"#ifdef %s\0A\00"
@.str.11 = [14 x i8] c"\09{\22%s\22, %s},\0A\00"
@.str.12 = [8 x i8] c"#endif\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [4096 x i8]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i8* %18)
store i32 1, i32* %3
br label %177
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %24, i32** %6
%25 = load i32*, i32** %6
%26 = icmp ne i32* %25, null
br i1 %26, label %30, label %27
27: ; preds = %20
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %177
30: ; preds = %20
br label %31
31: ; preds = %173, %30
%32 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%33 = load i32*, i32** %6
%34 = call i64 @fgets(i8* %32, i32 4096, i32* %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %174
36: ; preds = %31
%37 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
store i8* %37, i8** %8
br label %38
38: ; preds = %50, %36
%39 = load i8*, i8** %8
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 32
br i1 %42, label %48, label %43
43: ; preds = %38
%44 = load i8*, i8** %8
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 9
br label %48
48: ; preds = %43, %38
%49 = phi i1 [ true, %38 ], [ %47, %43 ]
br i1 %49, label %50, label %53
50: ; preds = %48
%51 = load i8*, i8** %8
%52 = getelementptr inbounds i8, i8* %51, i32 1
store i8* %52, i8** %8
br label %38
53: ; preds = %48
%54 = load i8*, i8** %8
%55 = call i8* @strchr(i8* %54, i8 signext 10)
store i8* %55, i8** %9
%56 = load i8*, i8** %9
%57 = icmp ne i8* %56, null
br i1 %57, label %58, label %60
58: ; preds = %53
%59 = load i8*, i8** %9
store i8 0, i8* %59
br label %60
60: ; preds = %58, %53
%61 = load i8*, i8** %8
%62 = call i64 @strncmp(i8* %61, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 6)
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %60
%65 = load i8*, i8** %8
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %65)
br label %67
67: ; preds = %64, %60
%68 = load i8*, i8** %8
%69 = call i64 @strncmp(i8* %68, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 6)
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %67
%72 = load i8*, i8** %8
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %72)
br label %173
74: ; preds = %67
%75 = load i8*, i8** %8
%76 = call i64 @strncmp(i8* %75, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %74
%79 = load i8*, i8** %8
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %79)
br label %172
81: ; preds = %74
%82 = load i8*, i8** %8
%83 = call i64 @strncmp(i8* %82, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 7)
%84 = icmp eq i64 %83, 0
br i1 %84, label %85, label %171
85: ; preds = %81
%86 = load i8*, i8** %8
%87 = call i8* @strstr(i8* %86, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
store i8* %87, i8** %10
%88 = load i8*, i8** %8
%89 = call i8* @strstr(i8* %88, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
store i8* %89, i8** %11
%90 = load i8*, i8** %10
%91 = icmp ne i8* %90, null
br i1 %91, label %92, label %95
92: ; preds = %85
%93 = load i8*, i8** %11
%94 = icmp ne i8* %93, null
br i1 %94, label %101, label %95
95: ; preds = %92, %85
%96 = load i32, i32* @stderr
%97 = load i8*, i8** %8
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8* %97)
%99 = load i32*, i32** %6
%100 = call i32 @fclose(i32* %99)
store i32 1, i32* %3
br label %177
101: ; preds = %92
%102 = load i8*, i8** %11
%103 = getelementptr inbounds i8, i8* %102, i64 -1
store i8 0, i8* %103
%104 = load i8*, i8** %10
store i8* %104, i8** %12
br label %105
105: ; preds = %122, %101
%106 = load i8*, i8** %12
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = icmp ne i32 %108, 32
br i1 %109, label %110, label %120
110: ; preds = %105
%111 = load i8*, i8** %12
%112 = load i8, i8* %111
%113 = sext i8 %112 to i32
%114 = icmp ne i32 %113, 9
br i1 %114, label %115, label %120
115: ; preds = %110
%116 = load i8*, i8** %12
%117 = load i8, i8* %116
%118 = sext i8 %117 to i32
%119 = icmp ne i32 %118, 0
br label %120
120: ; preds = %115, %110, %105
%121 = phi i1 [ false, %110 ], [ false, %105 ], [ %119, %115 ]
br i1 %121, label %122, label %125
122: ; preds = %120
%123 = load i8*, i8** %12
%124 = getelementptr inbounds i8, i8* %123, i32 1
store i8* %124, i8** %12
br label %105
125: ; preds = %120
%126 = load i8*, i8** %12
store i8 0, i8* %126
%127 = load i8*, i8** %11
store i8* %127, i8** %12
br label %128
128: ; preds = %145, %125
%129 = load i8*, i8** %12
%130 = load i8, i8* %129
%131 = sext i8 %130 to i32
%132 = icmp ne i32 %131, 32
br i1 %132, label %133, label %143
133: ; preds = %128
%134 = load i8*, i8** %12
%135 = load i8, i8* %134
%136 = sext i8 %135 to i32
%137 = icmp ne i32 %136, 9
br i1 %137, label %138, label %143
138: ; preds = %133
%139 = load i8*, i8** %12
%140 = load i8, i8* %139
%141 = sext i8 %140 to i32
%142 = icmp ne i32 %141, 0
br label %143
143: ; preds = %138, %133, %128
%144 = phi i1 [ false, %133 ], [ false, %128 ], [ %142, %138 ]
br i1 %144, label %145, label %148
145: ; preds = %143
%146 = load i8*, i8** %12
%147 = getelementptr inbounds i8, i8* %146, i32 1
store i8* %147, i8** %12
br label %128
148: ; preds = %143
%149 = load i8*, i8** %12
store i8 0, i8* %149
%150 = load i8*, i8** %10
store i8* %150, i8** %12
br label %151
151: ; preds = %156, %148
%152 = load i8*, i8** %12
%153 = load i8, i8* %152
%154 = sext i8 %153 to i32
%155 = icmp ne i32 %154, 95
br i1 %155, label %156, label %159
156: ; preds = %151
%157 = load i8*, i8** %12
%158 = getelementptr inbounds i8, i8* %157, i32 1
store i8* %158, i8** %12
br label %151
159: ; preds = %151
%160 = load i8*, i8** %12
%161 = getelementptr inbounds i8, i8* %160, i32 1
store i8* %161, i8** %12
%162 = load i8*, i8** %10
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* %162)
%164 = load i8*, i8** %11
%165 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* %164)
%166 = load i8*, i8** %12
%167 = load i8*, i8** %11
%168 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %166, i8* %167)
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%170 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
br label %171
171: ; preds = %159, %81
br label %172
172: ; preds = %171, %78
br label %173
173: ; preds = %172, %71
br label %31
174: ; preds = %31
%175 = load i32*, i32** %6
%176 = call i32 @fclose(i32* %175)
store i32 0, i32* %3
br label %177
177: ; preds = %174, %95, %27, %15
%178 = load i32, i32* %3
ret i32 %178
}

LLVM IR (-O2):
@.str = [69 x i8] c"usage: %s /media/ubuntu/usr/include/x86_64-linux-gnu/bits/syscall.h\0A\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [25 x i8] c"Error: cannot open file\0A\00"
@.str.5 = [4 x i8] c"#if\00"
@.str.6 = [8 x i8] c"#define\00"
@.str.7 = [5 x i8] c"SYS_\00"
@.str.8 = [6 x i8] c"__NR_\00"
@.str.9 = [26 x i8] c"Error: cannot parse \22%s\22\0A\00"
@.str.10 = [11 x i8] c"#ifdef %s\0A\00"
@.str.11 = [14 x i8] c"\09{\22%s\22, %s},\0A\00"
@str.13 = [7 x i8] c"#endif\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = icmp eq i32 %0, 2
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %89
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %89
16: ; preds = %8
%17 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%18 = call i64 @fgets(i8* %17, i32 4096, i32* %11)
%19 = icmp eq i64 %18, 0
br i1 %19, label %86, label %20
20: ; preds = %16, %25
%21 = phi i8* [ %26, %25 ], [ %17, %16 ]
%22 = load i8, i8* %21
switch i8 %22, label %27 [
i8 32, label %23
i8 9, label %23
]
23: ; preds = %20, %20
%24 = getelementptr inbounds i8, i8* %21, i64 1
br label %25
25: ; preds = %23, %83
%26 = phi i8* [ %24, %23 ], [ %17, %83 ]
br label %20
27: ; preds = %20
%28 = call i8* @strchr(i8* %21, i8 signext 10)
%29 = icmp eq i8* %28, null
br i1 %29, label %31, label %30
30: ; preds = %27
store i8 0, i8* %28
br label %31
31: ; preds = %30, %27
%32 = call i64 @strncmp(i8* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.13, i64 0, i64 0), i32 6)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @puts(i8* %21)
br label %36
36: ; preds = %34, %31
%37 = call i64 @strncmp(i8* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.13, i64 0, i64 0), i32 6)
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @puts(i8* %21)
br label %83
41: ; preds = %36
%42 = call i64 @strncmp(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 @puts(i8* %21)
br label %83
46: ; preds = %41
%47 = call i64 @strncmp(i8* %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 7)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %83
49: ; preds = %46
%50 = call i8* @strstr(i8* %21, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%51 = call i8* @strstr(i8* %21, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%52 = icmp ne i8* %50, null
%53 = icmp ne i8* %51, null
%54 = select i1 %52, i1 %53, i1 false
br i1 %54, label %58, label %55
55: ; preds = %49
%56 = load i32, i32* @stderr
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8* %21)
br label %86
58: ; preds = %49
%59 = getelementptr inbounds i8, i8* %51, i64 -1
store i8 0, i8* %59
br label %60
60: ; preds = %63, %58
%61 = phi i8* [ %50, %58 ], [ %64, %63 ]
%62 = load i8, i8* %61
switch i8 %62, label %63 [
i8 32, label %65
i8 9, label %65
i8 0, label %65
]
63: ; preds = %60
%64 = getelementptr inbounds i8, i8* %61, i64 1
br label %60
65: ; preds = %60, %60, %60
store i8 0, i8* %61
br label %66
66: ; preds = %69, %65
%67 = phi i8* [ %51, %65 ], [ %70, %69 ]
%68 = load i8, i8* %67
switch i8 %68, label %69 [
i8 32, label %71
i8 9, label %71
i8 0, label %71
]
69: ; preds = %66
%70 = getelementptr inbounds i8, i8* %67, i64 1
br label %66
71: ; preds = %66, %66, %66
store i8 0, i8* %67
br label %72
72: ; preds = %72, %71
%73 = phi i8* [ %50, %71 ], [ %76, %72 ]
%74 = load i8, i8* %73
%75 = icmp eq i8 %74, 95
%76 = getelementptr inbounds i8, i8* %73, i64 1
br i1 %75, label %77, label %72
77: ; preds = %72
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* %50)
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* %51)
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %76, i8* %51)
%81 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.13, i64 0, i64 0))
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.13, i64 0, i64 0))
br label %83
83: ; preds = %77, %39, %46, %44
%84 = call i64 @fgets(i8* %17, i32 4096, i32* %11)
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %25
86: ; preds = %83, %16, %55
%87 = phi i32 [ 1, %55 ], [ 0, %16 ], [ 0, %83 ]
%88 = call i32 @fclose(i32* %11)
br label %89
89: ; preds = %13, %86, %5
%90 = phi i32 [ 1, %5 ], [ %87, %86 ], [ 1, %13 ]
ret i32 %90
}