#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 ssize_t;
typedef int /*<<< orphan*/ msg;
typedef int /*<<< orphan*/ command;
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int O_CLOEXEC;
int O_RDONLY;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, unsigned int,
                         int /*<<< orphan*/);
int /*<<< orphan*/ isdigit(char);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ my_is_alnum_punct(char);
int open(char *, int);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int read(int, unsigned char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  FILE *fp;
  char buffer[4096 + 80];
  char command[512] = "";
  int found = 0;
  if (argc != 2) {
    char msg[] = "usage: get_kernel_version <kernel_image>\n";
    write(2, msg, sizeof(msg));
    return 1;
  }
  {
    unsigned char buf[2];
    int fd = open(argv[1], O_RDONLY | O_CLOEXEC);
    if (fd == -1) {
      fprintf(stderr, "Cannot open kernel image \"%s\"\n", argv[1]);
      return 1;
    }
    if (read(fd, buf, 2) != 2) {
      fprintf(stderr, "Short read\n");
      close(fd);
      return 1;
    }
    if (buf[0] == 037 && (buf[1] == 0213 || buf[1] == 0236)) {
      snprintf(command, sizeof(command), "/bin/gzip -dc %s 2>/dev/null",
               argv[1]);
      fp = popen(command, "re");
      if (fp == NULL) {
        fprintf(stderr, "%s: faild\n", command);
        return 1;
      }
    } else {
      fp = fopen(argv[1], "re");
    }
    close(fd);
  }
  memset(buffer, 0, sizeof(buffer));
  while (!found) {
    ssize_t in;
    int i;
    in = fread(&buffer[80], 1, sizeof(buffer) - 80, fp);
    if (in <= 0)
      break;
    for (i = 0; i < in; i++)
      if (buffer[i] == 'L' && buffer[i + 1] == 'i' && buffer[i + 2] == 'n' &&
          buffer[i + 3] == 'u' && buffer[i + 4] == 'x' &&
          buffer[i + 5] == ' ' && buffer[i + 6] == 'v' &&
          buffer[i + 7] == 'e' && buffer[i + 8] == 'r' &&
          buffer[i + 9] == 's' && buffer[i + 10] == 'i' &&
          buffer[i + 11] == 'o' && buffer[i + 12] == 'n' &&
          buffer[i + 13] == ' ') {
        int j = i + 14;
        int number_dots = 0;
        for (j = j + 1; buffer[j] != ' '; j++) {
          char c = buffer[j];
          if (c == '.') {
            number_dots++;
            continue;
          }
          if (((number_dots < 2) && !isdigit(c)) ||
              ((number_dots >= 2) && !my_is_alnum_punct(c))) {
            fprintf(stderr, "invalid char %c\n", c);
            break;
          }
        }
        found = 1;
        break;
      }
    if (found) {
      int j;
      for (j = i + 14; buffer[j] != ' '; j++)
        ;
      buffer[j] = '\0';
      printf("%s\n", &buffer[i + 14]);
    } else {
      if (in < (ssize_t)(sizeof(buffer) - 80))
        break;
      memcpy(&buffer[0], &buffer[sizeof(buffer) - 80], 80);
      memset(&buffer[80], 0, sizeof(buffer) - 80);
    }
  }
  if (!found) {
    if (!fseek(fp, 0x202, SEEK_SET) && fread(buffer, 1, 4, fp) == 4 &&
        buffer[0] == 0x48 && buffer[1] == 0x64 && buffer[2] == 0x72 &&
        buffer[3] == 0x53 && !fseek(fp, 0x20e, SEEK_SET) &&
        fread(buffer, 1, 2, fp) == 2) {
      unsigned ofs = 0x200 + ((unsigned char *)buffer)[0] +
                     (((unsigned char *)buffer)[1] << 8);
      if (!fseek(fp, ofs, SEEK_SET) && fread(buffer, 1, 80, fp) == 80) {
        char *s = buffer;
        for (s[80] = 0; *s; s++)
          if (*s == ' ') {
            *s = 0;
            break;
          }
        if (*buffer) {
          found = 1;
          printf("%s\n", buffer);
        }
      }
    }
  }
  if (command[0] != '\0')
    pclose(fp);
  else
    fclose(fp);
  if (found)
    return 0;
  else
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x12d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1270(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   10a0 <memset@plt>
movl   $0x0,-0x1274(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     128a <main+0x7a>
lea    -0x12a0(%rbp),%rdi
lea    0xda2(%rip),%rsi
mov    $0x2a,%edx
call   10e0 <memcpy@plt>
lea    -0x12a0(%rbp),%rsi
mov    $0x2,%edi
mov    $0x2a,%edx
call   1050 <write@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a0d <main+0x7fd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2d4f(%rip),%rax
mov    (%rax),%esi
mov    0x2d1e(%rip),%rax
or     (%rax),%esi
call   1110 <open@plt>
mov    %eax,-0x12a8(%rbp)
cmpl   $0xffffffff,-0x12a8(%rbp)
jne    12e7 <main+0xd7>
mov    0x2d15(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd56(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a0d <main+0x7fd>
mov    -0x12a8(%rbp),%edi
lea    -0x12a2(%rbp),%rsi
mov    $0x2,%edx
call   10c0 <read@plt>
cmp    $0x2,%eax
je     1335 <main+0x125>
mov    0x2cca(%rip),%rax
mov    (%rax),%edi
lea    0xd32(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x12a8(%rbp),%edi
call   10b0 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a0d <main+0x7fd>
movzbl -0x12a2(%rbp),%eax
cmp    $0x1f,%eax
jne    13da <main+0x1ca>
movzbl -0x12a1(%rbp),%eax
cmp    $0x8b,%eax
je     1369 <main+0x159>
movzbl -0x12a1(%rbp),%eax
cmp    $0x9e,%eax
jne    13da <main+0x1ca>
lea    -0x1270(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    $0x200,%esi
lea    0xcd1(%rip),%rdx
call   1090 <snprintf@plt>
lea    -0x1270(%rbp),%rdi
lea    0xcdb(%rip),%rsi
call   1120 <popen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    13d5 <main+0x1c5>
mov    0x2c26(%rip),%rax
mov    (%rax),%edi
lea    -0x1270(%rbp),%rdx
lea    0xcb3(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1a0d <main+0x7fd>
jmp    13f2 <main+0x1e2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc89(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x12a8(%rbp),%edi
call   10b0 <close@plt>
lea    -0x1070(%rbp),%rdi
xor    %esi,%esi
mov    $0x1050,%edx
call   10a0 <memset@plt>
cmpl   $0x0,-0x1274(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1429 <main+0x219>
jmp    17f1 <main+0x5e1>
lea    -0x1070(%rbp),%rdi
add    $0x50,%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x1000,%edx
call   1040 <fread@plt>
mov    %eax,-0x12ac(%rbp)
cmpl   $0x0,-0x12ac(%rbp)
jg     145f <main+0x24f>
jmp    17f1 <main+0x5e1>
movl   $0x0,-0x12b0(%rbp)
mov    -0x12b0(%rbp),%eax
cmp    -0x12ac(%rbp),%eax
jge    171f <main+0x50f>
movslq -0x12b0(%rbp),%rax
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x4c,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x69,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0x2,%eax
cltq
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x6e,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0x3,%eax
cltq
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x75,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0x4,%eax
cltq
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x78,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0x5,%eax
cltq
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0x6,%eax
cltq
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x76,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0x7,%eax
cltq
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x65,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0x8,%eax
cltq
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x72,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0x9,%eax
cltq
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x73,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0xa,%eax
cltq
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x69,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0xb,%eax
cltq
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x6f,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0xc,%eax
cltq
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x6e,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0xd,%eax
cltq
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
jne    1706 <main+0x4f6>
mov    -0x12b0(%rbp),%eax
add    $0xe,%eax
mov    %eax,-0x12b4(%rbp)
movl   $0x0,-0x12b8(%rbp)
mov    -0x12b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x12b4(%rbp)
movslq -0x12b4(%rbp),%rax
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
je     16f7 <main+0x4e7>
movslq -0x12b4(%rbp),%rax
mov    -0x1070(%rbp,%rax,1),%al
mov    %al,-0x12b9(%rbp)
movsbl -0x12b9(%rbp),%eax
cmp    $0x2e,%eax
jne    1677 <main+0x467>
mov    -0x12b8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x12b8(%rbp)
jmp    16e3 <main+0x4d3>
cmpl   $0x2,-0x12b8(%rbp)
jge    1699 <main+0x489>
movsbl -0x12b9(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     16bb <main+0x4ab>
cmpl   $0x2,-0x12b8(%rbp)
jl     16de <main+0x4ce>
movsbl -0x12b9(%rbp),%edi
call   10f0 <my_is_alnum_punct@plt>
cmp    $0x0,%eax
jne    16de <main+0x4ce>
mov    0x2916(%rip),%rax
mov    (%rax),%edi
movsbl -0x12b9(%rbp),%edx
lea    0x9ae(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    16f7 <main+0x4e7>
jmp    16e3 <main+0x4d3>
mov    -0x12b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x12b4(%rbp)
jmp    1627 <main+0x417>
movl   $0x1,-0x1274(%rbp)
jmp    171f <main+0x50f>
jmp    170b <main+0x4fb>
mov    -0x12b0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x12b0(%rbp)
jmp    1469 <main+0x259>
cmpl   $0x0,-0x1274(%rbp)
je     17a1 <main+0x591>
mov    -0x12b0(%rbp),%eax
add    $0xe,%eax
mov    %eax,-0x12c0(%rbp)
movslq -0x12c0(%rbp),%rax
movsbl -0x1070(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
je     176c <main+0x55c>
jmp    1758 <main+0x548>
mov    -0x12c0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x12c0(%rbp)
jmp    173b <main+0x52b>
movslq -0x12c0(%rbp),%rax
movb   $0x0,-0x1070(%rbp,%rax,1)
mov    -0x12b0(%rbp),%eax
add    $0xe,%eax
cltq
lea    -0x1070(%rbp),%rsi
add    %rax,%rsi
lea    0x8fa(%rip),%rdi
call   1070 <printf@plt>
jmp    17ec <main+0x5dc>
cmpl   $0x1000,-0x12ac(%rbp)
jge    17b6 <main+0x5a6>
jmp    17f1 <main+0x5e1>
lea    -0x1070(%rbp),%rdi
lea    -0x1070(%rbp),%rsi
add    $0x1000,%rsi
mov    $0x50,%edx
call   10e0 <memcpy@plt>
lea    -0x1070(%rbp),%rdi
add    $0x50,%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   10a0 <memset@plt>
jmp    1410 <main+0x200>
cmpl   $0x0,-0x1274(%rbp)
jne    19c6 <main+0x7b6>
mov    -0x18(%rbp),%rdi
mov    0x27c7(%rip),%rax
mov    (%rax),%edx
mov    $0x202,%esi
call   1100 <fseek@plt>
cmp    $0x0,%eax
jne    19c1 <main+0x7b1>
lea    -0x1070(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <fread@plt>
cmp    $0x4,%eax
jne    19c1 <main+0x7b1>
movsbl -0x1070(%rbp),%eax
cmp    $0x48,%eax
jne    19c1 <main+0x7b1>
movsbl -0x106f(%rbp),%eax
cmp    $0x64,%eax
jne    19c1 <main+0x7b1>
movsbl -0x106e(%rbp),%eax
cmp    $0x72,%eax
jne    19c1 <main+0x7b1>
movsbl -0x106d(%rbp),%eax
cmp    $0x53,%eax
jne    19c1 <main+0x7b1>
mov    -0x18(%rbp),%rdi
mov    0x2744(%rip),%rax
mov    (%rax),%edx
mov    $0x20e,%esi
call   1100 <fseek@plt>
cmp    $0x0,%eax
jne    19c1 <main+0x7b1>
lea    -0x1070(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x2,%edx
call   1040 <fread@plt>
cmp    $0x2,%eax
jne    19c1 <main+0x7b1>
movzbl -0x1070(%rbp),%eax
add    $0x200,%eax
movzbl -0x106f(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    %eax,-0x12c4(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x12c4(%rbp),%esi
mov    0x26dd(%rip),%rax
mov    (%rax),%edx
call   1100 <fseek@plt>
cmp    $0x0,%eax
jne    19bc <main+0x7ac>
lea    -0x1070(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x50,%edx
call   1040 <fread@plt>
cmp    $0x50,%eax
jne    19bc <main+0x7ac>
lea    -0x1070(%rbp),%rax
mov    %rax,-0x12d0(%rbp)
mov    -0x12d0(%rbp),%rax
movb   $0x0,0x50(%rax)
mov    -0x12d0(%rbp),%rax
cmpb   $0x0,(%rax)
je     198d <main+0x77d>
mov    -0x12d0(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1971 <main+0x761>
mov    -0x12d0(%rbp),%rax
movb   $0x0,(%rax)
jmp    198d <main+0x77d>
jmp    1976 <main+0x766>
mov    -0x12d0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x12d0(%rbp)
jmp    193f <main+0x72f>
cmpb   $0x0,-0x1070(%rbp)
je     19b7 <main+0x7a7>
movl   $0x1,-0x1274(%rbp)
lea    -0x1070(%rbp),%rsi
lea    0x6df(%rip),%rdi
call   1070 <printf@plt>
jmp    19bc <main+0x7ac>
jmp    19c1 <main+0x7b1>
jmp    19c6 <main+0x7b6>
movsbl -0x1270(%rbp),%eax
cmp    $0x0,%eax
je     19e4 <main+0x7d4>
mov    -0x18(%rbp),%rdi
call   1080 <pclose@plt>
jmp    19ed <main+0x7dd>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
cmpl   $0x0,-0x1274(%rbp)
je     1a06 <main+0x7f6>
movl   $0x0,-0x4(%rbp)
jmp    1a0d <main+0x7fd>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x12d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1258,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
mov    %rsp,%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   10a0 <memset@plt>
cmp    $0x2,%ebx
jne    12ed <main+0xdd>
mov    0x8(%rbp),%rdi
mov    0x2d9f(%rip),%rax
mov    0x2d70(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
call   1110 <open@plt>
cmp    $0xffffffff,%eax
je     133c <main+0x12c>
mov    %eax,%ebx
lea    0x200(%rsp),%rsi
mov    %eax,%edi
mov    $0x2,%edx
call   10c0 <read@plt>
cmp    $0x2,%eax
jne    1362 <main+0x152>
cmpb   $0x1f,0x200(%rsp)
1f
jne    138b <main+0x17b>
mov    0x201(%rsp),%al
cmp    $0x9e,%al
je     12a2 <main+0x92>
cmp    $0x8b,%al
jne    138b <main+0x17b>
mov    0x8(%rbp),%rcx
lea    0xda8(%rip),%rdx
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    $0x200,%esi
call   1090 <snprintf@plt>
lea    0xdae(%rip),%rsi
mov    %rbp,%rdi
call   1120 <popen@plt>
mov    %rax,%r12
test   %rax,%rax
jne    139e <main+0x18e>
mov    0x2cf9(%rip),%rax
mov    (%rax),%edi
lea    0xd8d(%rip),%rsi
mov    %rsp,%rdx
jmp    1350 <main+0x140>
movups 0xd26(%rip),%xmm0
movups %xmm0,0x21a(%rsp)
movaps 0xd0d(%rip),%xmm0
movaps %xmm0,0x210(%rsp)
movaps 0xcee(%rip),%xmm0
movaps %xmm0,0x200(%rsp)
lea    0x200(%rsp),%rsi
mov    $0x2,%edi
mov    $0x2a,%edx
call   1050 <write@plt>
mov    $0x1,%r13d
jmp    14ff <main+0x2ef>
mov    0x2c95(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbp),%rdx
lea    0xcda(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%r13d
jmp    14ff <main+0x2ef>
mov    0x2c6f(%rip),%rax
mov    (%rax),%edi
lea    0xcd7(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    $0x1,%r13d
jmp    14ff <main+0x2ef>
mov    0x8(%rbp),%rdi
lea    0xcdc(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,%r12
mov    %ebx,%edi
call   10b0 <close@plt>
lea    0x200(%rsp),%rdi
xor    %esi,%esi
mov    $0x1050,%edx
call   10a0 <memset@plt>
lea    0x250(%rsp),%rbx
mov    $0x1,%r13d
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
test   %eax,%eax
jle    14cd <main+0x2bd>
lea    0x20f(%rsp),%r15
nopl   0x0(%rax)
mov    %eax,%eax
mov    $0xe,%ebp
mov    %rax,%rcx
mov    %r15,%r14
jmp    140e <main+0x1fe>
nop
add    $0x1,%r14
add    $0x1,%rbp
add    $0xffffffffffffffff,%rcx
je     1480 <main+0x270>
cmpb   $0x4c,-0xf(%r14)
jne    1400 <main+0x1f0>
cmpb   $0x69,-0xe(%r14)
jne    1400 <main+0x1f0>
cmpb   $0x6e,-0xd(%r14)
jne    1400 <main+0x1f0>
cmpb   $0x75,-0xc(%r14)
jne    1400 <main+0x1f0>
cmpb   $0x78,-0xb(%r14)
jne    1400 <main+0x1f0>
cmpb   $0x20,-0xa(%r14)
jne    1400 <main+0x1f0>
cmpb   $0x76,-0x9(%r14)
jne    1400 <main+0x1f0>
cmpb   $0x65,-0x8(%r14)
jne    1400 <main+0x1f0>
cmpb   $0x72,-0x7(%r14)
jne    1400 <main+0x1f0>
cmpb   $0x73,-0x6(%r14)
jne    1400 <main+0x1f0>
cmpb   $0x69,-0x5(%r14)
jne    1400 <main+0x1f0>
cmpb   $0x6f,-0x4(%r14)
jne    1400 <main+0x1f0>
cmpb   $0x6e,-0x3(%r14)
jne    1400 <main+0x1f0>
cmpb   $0x20,-0x2(%r14)
jne    1400 <main+0x1f0>
jmp    1621 <main+0x411>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x1000,%eax
jl     14cd <main+0x2bd>
lea    0x200(%rsp),%rdi
lea    0x1200(%rsp),%rsi
mov    $0x50,%edx
call   10e0 <memcpy@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   10a0 <memset@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
test   %eax,%eax
jg     13f0 <main+0x1e0>
mov    0x2afc(%rip),%rbx
mov    (%rbx),%edx
mov    %r12,%rdi
mov    $0x202,%esi
call   1100 <fseek@plt>
test   %eax,%eax
je     1514 <main+0x304>
cmpb   $0x0,(%rsp)
je     14f7 <main+0x2e7>
mov    %r12,%rdi
call   1080 <pclose@plt>
jmp    14ff <main+0x2ef>
mov    %r12,%rdi
call   1060 <fclose@plt>
mov    %r13d,%eax
add    $0x1258,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x200(%rsp),%rdi
mov    $0x1,%r13d
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
cmp    $0x4,%eax
jne    14e7 <main+0x2d7>
cmpb   $0x48,0x200(%rsp)
48
jne    14e7 <main+0x2d7>
cmpb   $0x64,0x201(%rsp)
64
jne    14e7 <main+0x2d7>
cmpb   $0x72,0x202(%rsp)
72
jne    14e7 <main+0x2d7>
cmpb   $0x53,0x203(%rsp)
53
jne    14e7 <main+0x2d7>
mov    (%rbx),%edx
mov    %r12,%rdi
mov    $0x20e,%esi
call   1100 <fseek@plt>
test   %eax,%eax
jne    14e7 <main+0x2d7>
lea    0x200(%rsp),%rdi
mov    $0x1,%r13d
mov    $0x1,%esi
mov    $0x2,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
cmp    $0x2,%eax
jne    14e7 <main+0x2d7>
movzwl 0x200(%rsp),%esi
add    $0x200,%esi
mov    (%rbx),%edx
mov    %r12,%rdi
call   1100 <fseek@plt>
test   %eax,%eax
jne    14e7 <main+0x2d7>
lea    0x200(%rsp),%rbx
mov    $0x1,%r13d
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x50,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
cmp    $0x50,%eax
jne    14e7 <main+0x2d7>
movb   $0x0,0x250(%rsp)
movzbl (%rbx),%eax
test   %al,%al
je     1609 <main+0x3f9>
cmp    $0x20,%al
je     1606 <main+0x3f6>
add    $0x1,%rbx
jmp    15f5 <main+0x3e5>
movb   $0x0,(%rbx)
cmpb   $0x0,0x200(%rsp)
je     14e7 <main+0x2d7>
lea    0x200(%rsp),%rsi
jmp    1696 <main+0x486>
xor    %r15d,%r15d
jmp    162e <main+0x41e>
add    $0x1,%r15d
add    $0x1,%r14
movsbl (%r14),%ebx
cmp    $0x2e,%ebx
je     1626 <main+0x416>
cmp    $0x20,%bl
je     166d <main+0x45d>
mov    %ebx,%edi
cmp    $0x1,%r15d
jg     164b <main+0x43b>
call   1030 <isdigit@plt>
jmp    1650 <main+0x440>
call   10f0 <my_is_alnum_punct@plt>
test   %eax,%eax
jne    162a <main+0x41a>
mov    0x297d(%rip),%rax
mov    (%rax),%edi
lea    0xa1c(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %ebp,%eax
lea    -0x1(%rax),%rcx
cmpb   $0x20,0x201(%rsp,%rcx,1)
20
lea    0x1(%rcx),%rcx
jne    1673 <main+0x463>
mov    %ecx,%ecx
movb   $0x0,0x200(%rsp,%rcx,1)
lea    (%rsp,%rax,1),%rsi
add    $0x200,%rsi
lea    0x9f4(%rip),%rdi
call   1070 <printf@plt>
xor    %r13d,%r13d
jmp    14e7 <main+0x2d7>

LLVM IR (-O0):
@__const.main.msg = [42 x i8] c"usage: get_kernel_version <kernel_image>\0A\00"
@O_RDONLY = global i32 0
@O_CLOEXEC = global i32 0
@stderr = global i32 0
@.str = [31 x i8] c"Cannot open kernel image \22%s\22\0A\00"
@.str.1 = [12 x i8] c"Short read\0A\00"
@.str.2 = [29 x i8] c"/bin/gzip -dc %s 2>/dev/null\00"
@.str.3 = [3 x i8] c"re\00"
@.str.4 = [11 x i8] c"%s: faild\0A\00"
@.str.5 = [17 x i8] c"invalid char %c\0A\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@SEEK_SET = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [4176 x i8]
%8 = alloca [512 x i8]
%9 = alloca i32
%10 = alloca [42 x i8]
%11 = alloca [2 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8
%18 = alloca i32
%19 = alloca i32
%20 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%21 = bitcast [512 x i8]* %8 to i8*
store i32 0, i32* %9
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 2
br i1 %23, label %24, label %28
24: ; preds = %2
%25 = bitcast [42 x i8]* %10 to i8*
%26 = getelementptr inbounds [42 x i8], [42 x i8]* %10, i64 0, i64 0
%27 = call i32 @write(i32 2, i8* %26, i32 42)
store i32 1, i32* %3
br label %419
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = load i32, i32* @O_RDONLY
%33 = load i32, i32* @O_CLOEXEC
%34 = or i32 %32, %33
%35 = call i32 @open(i8* %31, i32 %34)
store i32 %35, i32* %12
%36 = load i32, i32* %12
%37 = icmp eq i32 %36, -1
br i1 %37, label %38, label %44
38: ; preds = %28
%39 = load i32, i32* @stderr
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %42)
store i32 1, i32* %3
br label %419
44: ; preds = %28
%45 = load i32, i32* %12
%46 = getelementptr inbounds [2 x i8], [2 x i8]* %11, i64 0, i64 0
%47 = call i32 @read(i32 %45, i8* %46, i32 2)
%48 = icmp ne i32 %47, 2
br i1 %48, label %49, label %54
49: ; preds = %44
%50 = load i32, i32* @stderr
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%52 = load i32, i32* %12
%53 = call i32 @close(i32 %52)
store i32 1, i32* %3
br label %419
54: ; preds = %44
%55 = getelementptr inbounds [2 x i8], [2 x i8]* %11, i64 0, i64 0
%56 = load i8, i8* %55
%57 = zext i8 %56 to i32
%58 = icmp eq i32 %57, 31
br i1 %58, label %59, label %84
59: ; preds = %54
%60 = getelementptr inbounds [2 x i8], [2 x i8]* %11, i64 0, i64 1
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = icmp eq i32 %62, 139
br i1 %63, label %69, label %64
64: ; preds = %59
%65 = getelementptr inbounds [2 x i8], [2 x i8]* %11, i64 0, i64 1
%66 = load i8, i8* %65
%67 = zext i8 %66 to i32
%68 = icmp eq i32 %67, 158
br i1 %68, label %69, label %84
69: ; preds = %64, %59
%70 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%71 = load i8**, i8*** %5
%72 = getelementptr inbounds i8*, i8** %71, i64 1
%73 = load i8*, i8** %72
%74 = call i32 @snprintf(i8* %70, i32 512, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %73)
%75 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%76 = call i32* @popen(i8* %75, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %76, i32** %6
%77 = load i32*, i32** %6
%78 = icmp eq i32* %77, null
br i1 %78, label %79, label %83
79: ; preds = %69
%80 = load i32, i32* @stderr
%81 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %81)
store i32 1, i32* %3
br label %419
83: ; preds = %69
br label %89
84: ; preds = %64, %54
%85 = load i8**, i8*** %5
%86 = getelementptr inbounds i8*, i8** %85, i64 1
%87 = load i8*, i8** %86
%88 = call i32* @fopen(i8* %87, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %88, i32** %6
br label %89
89: ; preds = %84, %83
%90 = load i32, i32* %12
%91 = call i32 @close(i32 %90)
%92 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 0
%93 = call i32 @memset(i8* %92, i32 0, i32 4176)
br label %94
94: ; preds = %308, %89
%95 = load i32, i32* %9
%96 = icmp ne i32 %95, 0
%97 = xor i1 %96, true
br i1 %97, label %98, label %309
98: ; preds = %94
%99 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 80
%100 = load i32*, i32** %6
%101 = call i32 @fread(i8* %99, i32 1, i32 4096, i32* %100)
store i32 %101, i32* %13
%102 = load i32, i32* %13
%103 = icmp sle i32 %102, 0
br i1 %103, label %104, label %105
104: ; preds = %98
br label %309
105: ; preds = %98
store i32 0, i32* %14
br label %106
106: ; preds = %269, %105
%107 = load i32, i32* %14
%108 = load i32, i32* %13
%109 = icmp slt i32 %107, %108
br i1 %109, label %110, label %272
110: ; preds = %106
%111 = load i32, i32* %14
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %112
%114 = load i8, i8* %113
%115 = sext i8 %114 to i32
%116 = icmp eq i32 %115, 76
br i1 %116, label %117, label %268
117: ; preds = %110
%118 = load i32, i32* %14
%119 = add nsw i32 %118, 1
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %120
%122 = load i8, i8* %121
%123 = sext i8 %122 to i32
%124 = icmp eq i32 %123, 105
br i1 %124, label %125, label %268
125: ; preds = %117
%126 = load i32, i32* %14
%127 = add nsw i32 %126, 2
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %128
%130 = load i8, i8* %129
%131 = sext i8 %130 to i32
%132 = icmp eq i32 %131, 110
br i1 %132, label %133, label %268
133: ; preds = %125
%134 = load i32, i32* %14
%135 = add nsw i32 %134, 3
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %136
%138 = load i8, i8* %137
%139 = sext i8 %138 to i32
%140 = icmp eq i32 %139, 117
br i1 %140, label %141, label %268
141: ; preds = %133
%142 = load i32, i32* %14
%143 = add nsw i32 %142, 4
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %144
%146 = load i8, i8* %145
%147 = sext i8 %146 to i32
%148 = icmp eq i32 %147, 120
br i1 %148, label %149, label %268
149: ; preds = %141
%150 = load i32, i32* %14
%151 = add nsw i32 %150, 5
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %152
%154 = load i8, i8* %153
%155 = sext i8 %154 to i32
%156 = icmp eq i32 %155, 32
br i1 %156, label %157, label %268
157: ; preds = %149
%158 = load i32, i32* %14
%159 = add nsw i32 %158, 6
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %160
%162 = load i8, i8* %161
%163 = sext i8 %162 to i32
%164 = icmp eq i32 %163, 118
br i1 %164, label %165, label %268
165: ; preds = %157
%166 = load i32, i32* %14
%167 = add nsw i32 %166, 7
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %168
%170 = load i8, i8* %169
%171 = sext i8 %170 to i32
%172 = icmp eq i32 %171, 101
br i1 %172, label %173, label %268
173: ; preds = %165
%174 = load i32, i32* %14
%175 = add nsw i32 %174, 8
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %176
%178 = load i8, i8* %177
%179 = sext i8 %178 to i32
%180 = icmp eq i32 %179, 114
br i1 %180, label %181, label %268
181: ; preds = %173
%182 = load i32, i32* %14
%183 = add nsw i32 %182, 9
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %184
%186 = load i8, i8* %185
%187 = sext i8 %186 to i32
%188 = icmp eq i32 %187, 115
br i1 %188, label %189, label %268
189: ; preds = %181
%190 = load i32, i32* %14
%191 = add nsw i32 %190, 10
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %192
%194 = load i8, i8* %193
%195 = sext i8 %194 to i32
%196 = icmp eq i32 %195, 105
br i1 %196, label %197, label %268
197: ; preds = %189
%198 = load i32, i32* %14
%199 = add nsw i32 %198, 11
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %200
%202 = load i8, i8* %201
%203 = sext i8 %202 to i32
%204 = icmp eq i32 %203, 111
br i1 %204, label %205, label %268
205: ; preds = %197
%206 = load i32, i32* %14
%207 = add nsw i32 %206, 12
%208 = sext i32 %207 to i64
%209 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %208
%210 = load i8, i8* %209
%211 = sext i8 %210 to i32
%212 = icmp eq i32 %211, 110
br i1 %212, label %213, label %268
213: ; preds = %205
%214 = load i32, i32* %14
%215 = add nsw i32 %214, 13
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %216
%218 = load i8, i8* %217
%219 = sext i8 %218 to i32
%220 = icmp eq i32 %219, 32
br i1 %220, label %221, label %268
221: ; preds = %213
%222 = load i32, i32* %14
%223 = add nsw i32 %222, 14
store i32 %223, i32* %15
store i32 0, i32* %16
%224 = load i32, i32* %15
%225 = add nsw i32 %224, 1
store i32 %225, i32* %15
br label %226
226: ; preds = %264, %221
%227 = load i32, i32* %15
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %228
%230 = load i8, i8* %229
%231 = sext i8 %230 to i32
%232 = icmp ne i32 %231, 32
br i1 %232, label %233, label %267
233: ; preds = %226
%234 = load i32, i32* %15
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %235
%237 = load i8, i8* %236
store i8 %237, i8* %17
%238 = load i8, i8* %17
%239 = sext i8 %238 to i32
%240 = icmp eq i32 %239, 46
br i1 %240, label %241, label %244
241: ; preds = %233
%242 = load i32, i32* %16
%243 = add nsw i32 %242, 1
store i32 %243, i32* %16
br label %264
244: ; preds = %233
%245 = load i32, i32* %16
%246 = icmp slt i32 %245, 2
br i1 %246, label %247, label %251
247: ; preds = %244
%248 = load i8, i8* %17
%249 = call i32 @isdigit(i8 signext %248)
%250 = icmp ne i32 %249, 0
br i1 %250, label %251, label %258
251: ; preds = %247, %244
%252 = load i32, i32* %16
%253 = icmp sge i32 %252, 2
br i1 %253, label %254, label %263
254: ; preds = %251
%255 = load i8, i8* %17
%256 = call i32 @my_is_alnum_punct(i8 signext %255)
%257 = icmp ne i32 %256, 0
br i1 %257, label %263, label %258
258: ; preds = %254, %247
%259 = load i32, i32* @stderr
%260 = load i8, i8* %17
%261 = sext i8 %260 to i32
%262 = call i32 (i32, i8*, ...) @fprintf(i32 %259, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %261)
br label %267
263: ; preds = %254, %251
br label %264
264: ; preds = %263, %241
%265 = load i32, i32* %15
%266 = add nsw i32 %265, 1
store i32 %266, i32* %15
br label %226
267: ; preds = %258, %226
store i32 1, i32* %9
br label %272
268: ; preds = %213, %205, %197, %189, %181, %173, %165, %157, %149, %141, %133, %125, %117, %110
br label %269
269: ; preds = %268
%270 = load i32, i32* %14
%271 = add nsw i32 %270, 1
store i32 %271, i32* %14
br label %106
272: ; preds = %267, %106
%273 = load i32, i32* %9
%274 = icmp ne i32 %273, 0
br i1 %274, label %275, label %298
275: ; preds = %272
%276 = load i32, i32* %14
%277 = add nsw i32 %276, 14
store i32 %277, i32* %18
br label %278
278: ; preds = %286, %275
%279 = load i32, i32* %18
%280 = sext i32 %279 to i64
%281 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %280
%282 = load i8, i8* %281
%283 = sext i8 %282 to i32
%284 = icmp ne i32 %283, 32
br i1 %284, label %285, label %289
285: ; preds = %278
br label %286
286: ; preds = %285
%287 = load i32, i32* %18
%288 = add nsw i32 %287, 1
store i32 %288, i32* %18
br label %278
289: ; preds = %278
%290 = load i32, i32* %18
%291 = sext i32 %290 to i64
%292 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %291
store i8 0, i8* %292
%293 = load i32, i32* %14
%294 = add nsw i32 %293, 14
%295 = sext i32 %294 to i64
%296 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 %295
%297 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %296)
br label %308
298: ; preds = %272
%299 = load i32, i32* %13
%300 = icmp slt i32 %299, 4096
br i1 %300, label %301, label %302
301: ; preds = %298
br label %309
302: ; preds = %298
%303 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 0
%304 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 4096
%305 = call i32 @memcpy(i8* %303, i8* %304, i32 80)
%306 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 80
%307 = call i32 @memset(i8* %306, i32 0, i32 4096)
br label %308
308: ; preds = %302, %289
br label %94
309: ; preds = %301, %104, %94
%310 = load i32, i32* %9
%311 = icmp ne i32 %310, 0
br i1 %311, label %403, label %312
312: ; preds = %309
%313 = load i32*, i32** %6
%314 = load i32, i32* @SEEK_SET
%315 = call i32 @fseek(i32* %313, i32 514, i32 %314)
%316 = icmp ne i32 %315, 0
br i1 %316, label %402, label %317
317: ; preds = %312
%318 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 0
%319 = load i32*, i32** %6
%320 = call i32 @fread(i8* %318, i32 1, i32 4, i32* %319)
%321 = icmp eq i32 %320, 4
br i1 %321, label %322, label %402
322: ; preds = %317
%323 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 0
%324 = load i8, i8* %323
%325 = sext i8 %324 to i32
%326 = icmp eq i32 %325, 72
br i1 %326, label %327, label %402
327: ; preds = %322
%328 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 1
%329 = load i8, i8* %328
%330 = sext i8 %329 to i32
%331 = icmp eq i32 %330, 100
br i1 %331, label %332, label %402
332: ; preds = %327
%333 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 2
%334 = load i8, i8* %333
%335 = sext i8 %334 to i32
%336 = icmp eq i32 %335, 114
br i1 %336, label %337, label %402
337: ; preds = %332
%338 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 3
%339 = load i8, i8* %338
%340 = sext i8 %339 to i32
%341 = icmp eq i32 %340, 83
br i1 %341, label %342, label %402
342: ; preds = %337
%343 = load i32*, i32** %6
%344 = load i32, i32* @SEEK_SET
%345 = call i32 @fseek(i32* %343, i32 526, i32 %344)
%346 = icmp ne i32 %345, 0
br i1 %346, label %402, label %347
347: ; preds = %342
%348 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 0
%349 = load i32*, i32** %6
%350 = call i32 @fread(i8* %348, i32 1, i32 2, i32* %349)
%351 = icmp eq i32 %350, 2
br i1 %351, label %352, label %402
352: ; preds = %347
%353 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 0
%354 = getelementptr inbounds i8, i8* %353, i64 0
%355 = load i8, i8* %354
%356 = zext i8 %355 to i32
%357 = add nsw i32 512, %356
%358 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 0
%359 = getelementptr inbounds i8, i8* %358, i64 1
%360 = load i8, i8* %359
%361 = zext i8 %360 to i32
%362 = shl i32 %361, 8
%363 = add nsw i32 %357, %362
store i32 %363, i32* %19
%364 = load i32*, i32** %6
%365 = load i32, i32* %19
%366 = load i32, i32* @SEEK_SET
%367 = call i32 @fseek(i32* %364, i32 %365, i32 %366)
%368 = icmp ne i32 %367, 0
br i1 %368, label %401, label %369
369: ; preds = %352
%370 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 0
%371 = load i32*, i32** %6
%372 = call i32 @fread(i8* %370, i32 1, i32 80, i32* %371)
%373 = icmp eq i32 %372, 80
br i1 %373, label %374, label %401
374: ; preds = %369
%375 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 0
store i8* %375, i8** %20
%376 = load i8*, i8** %20
%377 = getelementptr inbounds i8, i8* %376, i64 80
store i8 0, i8* %377
br label %378
378: ; preds = %390, %374
%379 = load i8*, i8** %20
%380 = load i8, i8* %379
%381 = icmp ne i8 %380, 0
br i1 %381, label %382, label %393
382: ; preds = %378
%383 = load i8*, i8** %20
%384 = load i8, i8* %383
%385 = sext i8 %384 to i32
%386 = icmp eq i32 %385, 32
br i1 %386, label %387, label %389
387: ; preds = %382
%388 = load i8*, i8** %20
store i8 0, i8* %388
br label %393
389: ; preds = %382
br label %390
390: ; preds = %389
%391 = load i8*, i8** %20
%392 = getelementptr inbounds i8, i8* %391, i32 1
store i8* %392, i8** %20
br label %378
393: ; preds = %387, %378
%394 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 0
%395 = load i8, i8* %394
%396 = icmp ne i8 %395, 0
br i1 %396, label %397, label %400
397: ; preds = %393
store i32 1, i32* %9
%398 = getelementptr inbounds [4176 x i8], [4176 x i8]* %7, i64 0, i64 0
%399 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %398)
br label %400
400: ; preds = %397, %393
br label %401
401: ; preds = %400, %369, %352
br label %402
402: ; preds = %401, %347, %342, %337, %332, %327, %322, %317, %312
br label %403
403: ; preds = %402, %309
%404 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%405 = load i8, i8* %404
%406 = sext i8 %405 to i32
%407 = icmp ne i32 %406, 0
br i1 %407, label %408, label %411
408: ; preds = %403
%409 = load i32*, i32** %6
%410 = call i32 @pclose(i32* %409)
br label %414
411: ; preds = %403
%412 = load i32*, i32** %6
%413 = call i32 @fclose(i32* %412)
br label %414
414: ; preds = %411, %408
%415 = load i32, i32* %9
%416 = icmp ne i32 %415, 0
br i1 %416, label %417, label %418
417: ; preds = %414
store i32 0, i32* %3
br label %419
418: ; preds = %414
store i32 1, i32* %3
br label %419
419: ; preds = %418, %417, %79, %49, %38, %24
%420 = load i32, i32* %3
ret i32 %420
}

LLVM IR (-O2):
@__const.main.msg = [42 x i8] c"usage: get_kernel_version <kernel_image>\0A\00"
@O_RDONLY = global i32 0
@O_CLOEXEC = global i32 0
@stderr = global i32 0
@.str = [31 x i8] c"Cannot open kernel image \22%s\22\0A\00"
@.str.1 = [12 x i8] c"Short read\0A\00"
@.str.2 = [29 x i8] c"/bin/gzip -dc %s 2>/dev/null\00"
@.str.3 = [3 x i8] c"re\00"
@.str.4 = [11 x i8] c"%s: faild\0A\00"
@.str.5 = [17 x i8] c"invalid char %c\0A\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@SEEK_SET = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4176 x i8]
%4 = alloca [512 x i8]
%5 = alloca [42 x i8]
%6 = alloca [2 x i8]
%7 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%9 = icmp eq i32 %0, 2
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = getelementptr inbounds [42 x i8], [42 x i8]* %5, i64 0, i64 0
%12 = call i32 @write(i32 2, i8* %11, i32 42)
br label %242
13: ; preds = %2
%14 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = load i32, i32* @O_RDONLY
%18 = load i32, i32* @O_CLOEXEC
%19 = or i32 %18, %17
%20 = tail call i32 @open(i8* %16, i32 %19)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %26
22: ; preds = %13
%23 = load i32, i32* @stderr
%24 = load i8*, i8** %15
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %24)
br label %50
26: ; preds = %13
%27 = call i32 @read(i32 %20, i8* %14, i32 2)
%28 = icmp eq i32 %27, 2
br i1 %28, label %33, label %29
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = tail call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%32 = tail call i32 @close(i32 %20)
br label %50
33: ; preds = %26
%34 = load i8, i8* %14
%35 = icmp eq i8 %34, 31
br i1 %35, label %36, label %47
36: ; preds = %33
%37 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 1
%38 = load i8, i8* %37
switch i8 %38, label %47 [
i8 -98, label %39
i8 -117, label %39
]
39: ; preds = %36, %36
%40 = load i8*, i8** %15
%41 = call i32 @snprintf(i8* %8, i32 512, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %40)
%42 = call i32* @popen(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %51
44: ; preds = %39
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %8)
br label %50
47: ; preds = %36, %33
%48 = load i8*, i8** %15
%49 = tail call i32* @fopen(i8* %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %51
50: ; preds = %22, %29, %44
br label %242
51: ; preds = %39, %47
%52 = phi i32* [ %42, %39 ], [ %49, %47 ]
%53 = call i32 @close(i32 %20)
%54 = call i32 @memset(i8* %7, i32 0, i32 4176)
%55 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 80
%56 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 4096
%57 = call i32 @fread(i8* %55, i32 1, i32 4096, i32* %52)
%58 = icmp slt i32 %57, 1
br i1 %58, label %174, label %59
59: ; preds = %51, %169
%60 = phi i32 [ %172, %169 ], [ %57, %51 ]
%61 = zext i32 %60 to i64
br label %62
62: ; preds = %59, %156
%63 = phi i64 [ 0, %59 ], [ %67, %156 ]
%64 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %63
%65 = load i8, i8* %64
%66 = icmp eq i8 %65, 76
%67 = add nuw nsw i64 %63, 1
br i1 %66, label %68, label %156
68: ; preds = %62
%69 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %67
%70 = load i8, i8* %69
%71 = icmp eq i8 %70, 105
br i1 %71, label %72, label %156
72: ; preds = %68
%73 = add nuw nsw i64 %63, 2
%74 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %73
%75 = load i8, i8* %74
%76 = icmp eq i8 %75, 110
br i1 %76, label %77, label %156
77: ; preds = %72
%78 = add nuw nsw i64 %63, 3
%79 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %78
%80 = load i8, i8* %79
%81 = icmp eq i8 %80, 117
br i1 %81, label %82, label %156
82: ; preds = %77
%83 = add nuw nsw i64 %63, 4
%84 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %83
%85 = load i8, i8* %84
%86 = icmp eq i8 %85, 120
br i1 %86, label %87, label %156
87: ; preds = %82
%88 = add nuw nsw i64 %63, 5
%89 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %88
%90 = load i8, i8* %89
%91 = icmp eq i8 %90, 32
br i1 %91, label %92, label %156
92: ; preds = %87
%93 = add nuw nsw i64 %63, 6
%94 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %93
%95 = load i8, i8* %94
%96 = icmp eq i8 %95, 118
br i1 %96, label %97, label %156
97: ; preds = %92
%98 = add nuw nsw i64 %63, 7
%99 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %98
%100 = load i8, i8* %99
%101 = icmp eq i8 %100, 101
br i1 %101, label %102, label %156
102: ; preds = %97
%103 = add nuw nsw i64 %63, 8
%104 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %103
%105 = load i8, i8* %104
%106 = icmp eq i8 %105, 114
br i1 %106, label %107, label %156
107: ; preds = %102
%108 = add nuw nsw i64 %63, 9
%109 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %108
%110 = load i8, i8* %109
%111 = icmp eq i8 %110, 115
br i1 %111, label %112, label %156
112: ; preds = %107
%113 = add nuw nsw i64 %63, 10
%114 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %113
%115 = load i8, i8* %114
%116 = icmp eq i8 %115, 105
br i1 %116, label %117, label %156
117: ; preds = %112
%118 = add nuw nsw i64 %63, 11
%119 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %118
%120 = load i8, i8* %119
%121 = icmp eq i8 %120, 111
br i1 %121, label %122, label %156
122: ; preds = %117
%123 = add nuw nsw i64 %63, 12
%124 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %123
%125 = load i8, i8* %124
%126 = icmp eq i8 %125, 110
br i1 %126, label %127, label %156
127: ; preds = %122
%128 = add nuw nsw i64 %63, 13
%129 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %128
%130 = load i8, i8* %129
%131 = icmp eq i8 %130, 32
br i1 %131, label %132, label %156
132: ; preds = %127
%133 = add nuw nsw i64 %63, 15
br label %134
134: ; preds = %153, %132
%135 = phi i64 [ %155, %153 ], [ %133, %132 ]
%136 = phi i32 [ %154, %153 ], [ 0, %132 ]
%137 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %135
%138 = load i8, i8* %137
switch i8 %138, label %141 [
i8 32, label %158
i8 46, label %139
]
139: ; preds = %134
%140 = add nsw i32 %136, 1
br label %153
141: ; preds = %134
%142 = icmp slt i32 %136, 2
br i1 %142, label %143, label %146
143: ; preds = %141
%144 = call i32 @isdigit(i8 signext %138)
%145 = icmp eq i32 %144, 0
br i1 %145, label %149, label %153
146: ; preds = %141
%147 = call i32 @my_is_alnum_punct(i8 signext %138)
%148 = icmp eq i32 %147, 0
br i1 %148, label %149, label %153
149: ; preds = %143, %146
%150 = sext i8 %138 to i32
%151 = load i32, i32* @stderr
%152 = call i32 (i32, i8*, ...) @fprintf(i32 %151, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %150)
br label %158
153: ; preds = %139, %146, %143
%154 = phi i32 [ %136, %143 ], [ %136, %146 ], [ %140, %139 ]
%155 = add nuw i64 %135, 1
br label %134
156: ; preds = %62, %68, %72, %77, %82, %87, %92, %97, %102, %107, %112, %117, %122, %127
%157 = icmp eq i64 %67, %61
br i1 %157, label %167, label %62
158: ; preds = %134, %149
%159 = add nuw i64 %63, 14
%160 = and i64 %159, 4294967295
br label %161
161: ; preds = %161, %158
%162 = phi i64 [ %166, %161 ], [ %160, %158 ]
%163 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %162
%164 = load i8, i8* %163
%165 = icmp eq i8 %164, 32
%166 = add nuw i64 %162, 1
br i1 %165, label %227, label %161
167: ; preds = %156
%168 = icmp slt i32 %60, 4096
br i1 %168, label %174, label %169
169: ; preds = %167
%170 = call i32 @memcpy(i8* %7, i8* %56, i32 80)
%171 = call i32 @memset(i8* %55, i32 0, i32 4096)
%172 = call i32 @fread(i8* %55, i32 1, i32 4096, i32* %52)
%173 = icmp slt i32 %172, 1
br i1 %173, label %174, label %59
174: ; preds = %167, %169, %51
%175 = load i32, i32* @SEEK_SET
%176 = call i32 @fseek(i32* %52, i32 514, i32 %175)
%177 = icmp eq i32 %176, 0
br i1 %177, label %178, label %234
178: ; preds = %174
%179 = call i32 @fread(i8* %7, i32 1, i32 4, i32* %52)
%180 = icmp eq i32 %179, 4
%181 = load i8, i8* %7
%182 = icmp eq i8 %181, 72
%183 = select i1 %180, i1 %182, i1 false
%184 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 1
%185 = load i8, i8* %184
%186 = icmp eq i8 %185, 100
%187 = select i1 %183, i1 %186, i1 false
%188 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 2
%189 = load i8, i8* %188
%190 = icmp eq i8 %189, 114
%191 = select i1 %187, i1 %190, i1 false
%192 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 3
%193 = load i8, i8* %192
%194 = icmp eq i8 %193, 83
%195 = select i1 %191, i1 %194, i1 false
br i1 %195, label %196, label %234
196: ; preds = %178
%197 = load i32, i32* @SEEK_SET
%198 = call i32 @fseek(i32* %52, i32 526, i32 %197)
%199 = icmp eq i32 %198, 0
br i1 %199, label %200, label %234
200: ; preds = %196
%201 = call i32 @fread(i8* %7, i32 1, i32 2, i32* %52)
%202 = icmp eq i32 %201, 2
br i1 %202, label %203, label %234
203: ; preds = %200
%204 = load i8, i8* %7
%205 = zext i8 %204 to i32
%206 = or i32 %205, 512
%207 = load i8, i8* %184
%208 = zext i8 %207 to i32
%209 = shl nuw nsw i32 %208, 8
%210 = add nuw nsw i32 %206, %209
%211 = load i32, i32* @SEEK_SET
%212 = call i32 @fseek(i32* %52, i32 %210, i32 %211)
%213 = icmp eq i32 %212, 0
br i1 %213, label %214, label %234
214: ; preds = %203
%215 = call i32 @fread(i8* %7, i32 1, i32 80, i32* %52)
%216 = icmp eq i32 %215, 80
br i1 %216, label %217, label %234
217: ; preds = %214
store i8 0, i8* %55
br label %218
218: ; preds = %222, %217
%219 = phi i8* [ %7, %217 ], [ %223, %222 ]
%220 = load i8, i8* %219
switch i8 %220, label %222 [
i8 0, label %224
i8 32, label %221
]
221: ; preds = %218
store i8 0, i8* %219
br label %224
222: ; preds = %218
%223 = getelementptr inbounds i8, i8* %219, i64 1
br label %218
224: ; preds = %218, %221
%225 = load i8, i8* %7
%226 = icmp eq i8 %225, 0
br i1 %226, label %234, label %231
227: ; preds = %161
%228 = and i64 %162, 4294967295
%229 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %228
store i8 0, i8* %229
%230 = getelementptr inbounds [4176 x i8], [4176 x i8]* %3, i64 0, i64 %160
br label %231
231: ; preds = %224, %227
%232 = phi i8* [ %230, %227 ], [ %7, %224 ]
%233 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %232)
br label %234
234: ; preds = %231, %203, %214, %224, %174, %178, %196, %200
%235 = phi i32 [ 1, %203 ], [ 1, %214 ], [ 1, %224 ], [ 1, %174 ], [ 1, %178 ], [ 1, %196 ], [ 1, %200 ], [ 0, %231 ]
%236 = load i8, i8* %8
%237 = icmp eq i8 %236, 0
br i1 %237, label %240, label %238
238: ; preds = %234
%239 = call i32 @pclose(i32* %52)
br label %242
240: ; preds = %234
%241 = call i32 @fclose(i32* %52)
br label %242
242: ; preds = %238, %240, %50, %10
%243 = phi i32 [ 1, %10 ], [ 1, %50 ], [ %235, %240 ], [ %235, %238 ]
ret i32 %243
}