#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*/ SEEK_SET;
int atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int file_exists(char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int get_gif_length(char *);
int get_png_length(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ octal_to_dec(char *);
int /*<<< orphan*/ pad_str(char *, int, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
scalar_t__ strstr(char *, char *);
int system(char *);
int /*<<< orphan*/ to_date_time(int /*<<< orphan*/, char *);
void extract_entry(char *tarname, int i, int overwrite, int verbose,
                   int extract) {
  char filename[100];
  char mode[8];
  char owner[8];
  char group[8];
  char size[12];
  char modified[12];
  char checksum[8];
  char type[1];
  FILE *tar;
  tar = fopen(tarname, "rb");
  fseek(tar, i, SEEK_SET);
  fgets(filename, 99, tar);
  fseek(tar, i + 100, SEEK_SET);
  fgets(mode, 8, tar);
  fseek(tar, i + 108, SEEK_SET);
  fgets(owner, 8, tar);
  fseek(tar, i + 116, SEEK_SET);
  fgets(group, 8, tar);
  fseek(tar, i + 124, SEEK_SET);
  fgets(size, 12, tar);
  fseek(tar, i + 136, SEEK_SET);
  fgets(modified, 12, tar);
  fseek(tar, i + 148, SEEK_SET);
  fgets(checksum, 8, tar);
  fseek(tar, i + 156, SEEK_SET);
  fgets(type, 2, tar);
  char contents[10000];
  fseek(tar, i + 512, SEEK_SET);
  fread(contents, 10000, 1, tar);
  fclose(tar);
  if (verbose == 1 && extract == 1) {
    printf("%s\n", filename);
  } else {
    char smodified[25];
    char ssize[12];
    pad_str(size, 12, ssize);
    to_date_time(octal_to_dec(modified), smodified);
    printf("%d    %s      %s    %s\n", atoi(mode), ssize, smodified, filename);
  }
  if (strcmp(type, "5") == 0 && extract == 1) {
    char command[1000];
    strcat(command, "mkdir ");
    strcat(command, "-p ");
    strcat(command, filename);
    int ec = system(command);
    if (ec == 1) {
      printf("tarino-native: Exit code from system call was 1.\n");
    }
    memset(command, 0, strlen(command));
  }
  if (strcmp(type, "0") == 0 && extract == 1) {
    if (overwrite == 1 || file_exists(filename) == 1) {
      FILE *out;
      out = fopen(filename, "wb");
      int length = strlen(contents);
      if (strstr(filename, ".gif") != 0) {
        length = get_gif_length(contents);
      }
      if (strstr(filename, ".png") != 0) {
        length = get_png_length(contents);
      }
      fwrite(contents, length, 1, out);
      fclose(out);
    }
  }
}


x86 assembly (clang, -O0):
<extract_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2c20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xd99(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0xc8(%rbp)
mov    -0xc8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2d5c(%rip),%rax
mov    (%rax),%edx
call   10f0 <fseek@plt>
lea    -0x80(%rbp),%rdi
mov    -0xc8(%rbp),%rdx
mov    $0x63,%esi
call   10c0 <fgets@plt>
mov    -0xc8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x64,%esi
mov    0x2d2c(%rip),%rax
mov    (%rax),%edx
call   10f0 <fseek@plt>
lea    -0x88(%rbp),%rdi
mov    -0xc8(%rbp),%rdx
mov    $0x8,%esi
call   10c0 <fgets@plt>
mov    -0xc8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x6c,%esi
mov    0x2cf9(%rip),%rax
mov    (%rax),%edx
call   10f0 <fseek@plt>
lea    -0x90(%rbp),%rdi
mov    -0xc8(%rbp),%rdx
mov    $0x8,%esi
call   10c0 <fgets@plt>
mov    -0xc8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x74,%esi
mov    0x2cc6(%rip),%rax
mov    (%rax),%edx
call   10f0 <fseek@plt>
lea    -0x98(%rbp),%rdi
mov    -0xc8(%rbp),%rdx
mov    $0x8,%esi
call   10c0 <fgets@plt>
mov    -0xc8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x7c,%esi
mov    0x2c93(%rip),%rax
mov    (%rax),%edx
call   10f0 <fseek@plt>
lea    -0xa4(%rbp),%rdi
mov    -0xc8(%rbp),%rdx
mov    $0xc,%esi
call   10c0 <fgets@plt>
mov    -0xc8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x88,%esi
mov    0x2c5d(%rip),%rax
mov    (%rax),%edx
call   10f0 <fseek@plt>
lea    -0xb0(%rbp),%rdi
mov    -0xc8(%rbp),%rdx
mov    $0xc,%esi
call   10c0 <fgets@plt>
mov    -0xc8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x94,%esi
mov    0x2c27(%rip),%rax
mov    (%rax),%edx
call   10f0 <fseek@plt>
lea    -0xb8(%rbp),%rdi
mov    -0xc8(%rbp),%rdx
mov    $0x8,%esi
call   10c0 <fgets@plt>
mov    -0xc8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x9c,%esi
mov    0x2bf1(%rip),%rax
mov    (%rax),%edx
call   10f0 <fseek@plt>
lea    -0xb9(%rbp),%rdi
mov    -0xc8(%rbp),%rdx
mov    $0x2,%esi
call   10c0 <fgets@plt>
mov    -0xc8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x200,%esi
mov    0x2bbb(%rip),%rax
mov    (%rax),%edx
call   10f0 <fseek@plt>
lea    -0x27e0(%rbp),%rdi
mov    -0xc8(%rbp),%rcx
mov    $0x2710,%esi
mov    $0x1,%edx
call   1050 <fread@plt>
mov    -0xc8(%rbp),%rdi
call   1070 <fclose@plt>
cmpl   $0x1,-0x14(%rbp)
jne    1480 <extract_entry+0x240>
cmpl   $0x1,-0x18(%rbp)
jne    1480 <extract_entry+0x240>
lea    -0x80(%rbp),%rsi
lea    0xba3(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    14e0 <extract_entry+0x2a0>
lea    -0xa4(%rbp),%rdi
lea    -0x280c(%rbp),%rdx
mov    $0xc,%esi
call   1140 <pad_str@plt>
lea    -0xb0(%rbp),%rdi
call   1130 <octal_to_dec@plt>
mov    %eax,%edi
lea    -0x2800(%rbp),%rsi
call   10e0 <to_date_time@plt>
lea    -0x88(%rbp),%rdi
call   1110 <atoi@plt>
mov    %eax,%esi
lea    -0x280c(%rbp),%rdx
lea    -0x2800(%rbp),%rcx
lea    -0x80(%rbp),%r8
lea    0xb2a(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    -0xb9(%rbp),%rdi
lea    0xb2d(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
jne    1594 <extract_entry+0x354>
cmpl   $0x1,-0x18(%rbp)
jne    1594 <extract_entry+0x354>
lea    -0x2c00(%rbp),%rdi
lea    0xb08(%rip),%rsi
call   1120 <strcat@plt>
lea    -0x2c00(%rbp),%rdi
lea    0xafc(%rip),%rsi
call   1120 <strcat@plt>
lea    -0x2c00(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1120 <strcat@plt>
lea    -0x2c00(%rbp),%rdi
call   1090 <system@plt>
mov    %eax,-0x2c04(%rbp)
cmpl   $0x1,-0x2c04(%rbp)
jne    156a <extract_entry+0x32a>
lea    0xac5(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    -0x2c00(%rbp),%rax
mov    %rax,-0x2c20(%rbp)
lea    -0x2c00(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x2c20(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   10b0 <memset@plt>
lea    -0xb9(%rbp),%rdi
lea    0xab8(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
jne    1687 <extract_entry+0x447>
cmpl   $0x1,-0x18(%rbp)
jne    1687 <extract_entry+0x447>
cmpl   $0x1,-0x10(%rbp)
je     15d7 <extract_entry+0x397>
lea    -0x80(%rbp),%rdi
call   1040 <file_exists@plt>
cmp    $0x1,%eax
jne    1682 <extract_entry+0x442>
lea    -0x80(%rbp),%rdi
lea    0xa7a(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x2c10(%rbp)
lea    -0x27e0(%rbp),%rdi
call   1080 <strlen@plt>
mov    %eax,-0x2c14(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xa54(%rip),%rsi
call   1160 <strstr@plt>
cmp    $0x0,%rax
je     162c <extract_entry+0x3ec>
lea    -0x27e0(%rbp),%rdi
call   1030 <get_gif_length@plt>
mov    %eax,-0x2c14(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xa2d(%rip),%rsi
call   1160 <strstr@plt>
cmp    $0x0,%rax
je     1658 <extract_entry+0x418>
lea    -0x27e0(%rbp),%rdi
call   1060 <get_png_length@plt>
mov    %eax,-0x2c14(%rbp)
lea    -0x27e0(%rbp),%rdi
mov    -0x2c14(%rbp),%esi
mov    -0x2c10(%rbp),%rcx
mov    $0x1,%edx
call   1150 <fwrite@plt>
mov    -0x2c10(%rbp),%rdi
call   1070 <fclose@plt>
jmp    1687 <extract_entry+0x447>
add    $0x2c20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_entry>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2bc8,%rsp
mov    %r8d,%r12d
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %esi,%ebp
lea    0xd8d(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%rbx
mov    0x2d5e(%rip),%r13
mov    0x0(%r13),%edx
mov    %rax,%rdi
mov    %ebp,%esi
call   1100 <fseek@plt>
lea    0x50(%rsp),%rdi
mov    $0x63,%esi
mov    %rbx,%rdx
call   10d0 <fgets@plt>
lea    0x64(%rbp),%esi
mov    0x0(%r13),%edx
mov    %rbx,%rdi
call   1100 <fseek@plt>
lea    0xc(%rsp),%rdi
mov    $0x8,%esi
mov    %rbx,%rdx
call   10d0 <fgets@plt>
lea    0x6c(%rbp),%esi
mov    0x0(%r13),%edx
mov    %rbx,%rdi
call   1100 <fseek@plt>
lea    0x3c(%rsp),%rdi
mov    $0x8,%esi
mov    %rbx,%rdx
call   10d0 <fgets@plt>
lea    0x74(%rbp),%esi
mov    0x0(%r13),%edx
mov    %rbx,%rdi
call   1100 <fseek@plt>
lea    0x34(%rsp),%rdi
mov    $0x8,%esi
mov    %rbx,%rdx
call   10d0 <fgets@plt>
lea    0x7c(%rbp),%esi
mov    0x0(%r13),%edx
mov    %rbx,%rdi
call   1100 <fseek@plt>
lea    0x20(%rsp),%rdi
mov    $0xc,%esi
mov    %rbx,%rdx
call   10d0 <fgets@plt>
lea    0x88(%rbp),%esi
mov    0x0(%r13),%edx
mov    %rbx,%rdi
call   1100 <fseek@plt>
lea    0x14(%rsp),%rdi
mov    $0xc,%esi
mov    %rbx,%rdx
call   10d0 <fgets@plt>
lea    0x94(%rbp),%esi
mov    0x0(%r13),%edx
mov    %rbx,%rdi
call   1100 <fseek@plt>
lea    0x2c(%rsp),%rdi
mov    $0x8,%esi
mov    %rbx,%rdx
call   10d0 <fgets@plt>
lea    0x9c(%rbp),%esi
mov    0x0(%r13),%edx
mov    %rbx,%rdi
call   1100 <fseek@plt>
lea    0xb(%rsp),%rdi
mov    $0x2,%esi
mov    %rbx,%rdx
call   10d0 <fgets@plt>
add    $0x200,%ebp
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1100 <fseek@plt>
lea    0x4b0(%rsp),%rdi
mov    $0x2710,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fread@plt>
mov    %rbx,%rdi
call   1080 <fclose@plt>
cmp    $0x1,%r15d
jne    13e0 <extract_entry+0x190>
cmp    $0x1,%r12d
jne    13e0 <extract_entry+0x190>
lea    0x50(%rsp),%rdi
call   1050 <puts@plt>
jmp    1438 <extract_entry+0x1e8>
lea    0x20(%rsp),%rdi
lea    0x44(%rsp),%rbx
mov    $0xc,%esi
mov    %rbx,%rdx
call   1150 <pad_str@plt>
lea    0x14(%rsp),%rdi
call   1140 <octal_to_dec@plt>
lea    0xc0(%rsp),%rbp
mov    %eax,%edi
mov    %rbp,%rsi
call   10f0 <to_date_time@plt>
lea    0xc(%rsp),%rdi
call   1120 <atoi@plt>
lea    0xbdf(%rip),%rdi
lea    0x50(%rsp),%r8
mov    %eax,%esi
mov    %rbx,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   10b0 <printf@plt>
lea    0xbdc(%rip),%rsi
lea    0xb(%rsp),%rdi
call   10e0 <strcmp@plt>
cmp    $0x1,%r12d
jne    14bc <extract_entry+0x26c>
test   %rax,%rax
jne    14bc <extract_entry+0x26c>
lea    0xbc2(%rip),%rsi
lea    0xc0(%rsp),%rbx
mov    %rbx,%rdi
call   1130 <strcat@plt>
lea    0xbb2(%rip),%rsi
mov    %rbx,%rdi
call   1130 <strcat@plt>
lea    0x50(%rsp),%rsi
mov    %rbx,%rdi
call   1130 <strcat@plt>
mov    %rbx,%rdi
call   10a0 <system@plt>
cmp    $0x1,%eax
jne    14a0 <extract_entry+0x250>
lea    0xb9c(%rip),%rdi
call   1050 <puts@plt>
lea    0xc0(%rsp),%rbx
mov    %rbx,%rdi
call   1090 <strlen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   10c0 <memset@plt>
lea    0xb65(%rip),%rsi
lea    0xb(%rsp),%rdi
call   10e0 <strcmp@plt>
cmp    $0x1,%r12d
jne    1586 <extract_entry+0x336>
test   %rax,%rax
jne    1586 <extract_entry+0x336>
cmp    $0x1,%r14d
je     14f9 <extract_entry+0x2a9>
lea    0x50(%rsp),%rdi
call   1040 <file_exists@plt>
cmp    $0x1,%eax
jne    1586 <extract_entry+0x336>
lea    0xb2a(%rip),%rsi
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
call   1110 <fopen@plt>
mov    %rax,%r14
lea    0x4b0(%rsp),%rdi
call   1090 <strlen@plt>
mov    %eax,%ebp
lea    0xb07(%rip),%rsi
mov    %rbx,%rdi
call   1170 <strstr@plt>
test   %rax,%rax
je     1542 <extract_entry+0x2f2>
lea    0x4b0(%rsp),%rdi
call   1030 <get_gif_length@plt>
mov    %eax,%ebp
lea    0xae9(%rip),%rsi
lea    0x50(%rsp),%rdi
call   1170 <strstr@plt>
test   %rax,%rax
je     1567 <extract_entry+0x317>
lea    0x4b0(%rsp),%rdi
call   1070 <get_png_length@plt>
mov    %eax,%ebp
lea    0x4b0(%rsp),%rdi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1160 <fwrite@plt>
mov    %r14,%rdi
call   1080 <fclose@plt>
add    $0x2bc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@SEEK_SET = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [24 x i8] c"%d %s %s %s\0A\00"
@.str.3 = [2 x i8] c"5\00"
@.str.4 = [7 x i8] c"mkdir \00"
@.str.5 = [4 x i8] c"-p \00"
@.str.6 = [50 x i8] c"tarino-native: Exit code from system call was 1.\0A\00"
@.str.7 = [2 x i8] c"0\00"
@.str.8 = [3 x i8] c"wb\00"
@.str.9 = [5 x i8] c".gif\00"
@.str.10 = [5 x i8] c".png\00"
define void @extract_entry(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [100 x i8]
%12 = alloca [8 x i8]
%13 = alloca [8 x i8]
%14 = alloca [8 x i8]
%15 = alloca [12 x i8]
%16 = alloca [12 x i8]
%17 = alloca [8 x i8]
%18 = alloca [1 x i8]
%19 = alloca i32*
%20 = alloca [10000 x i8]
%21 = alloca [25 x i8]
%22 = alloca [12 x i8]
%23 = alloca [1000 x i8]
%24 = alloca i32
%25 = alloca i32*
%26 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%27 = load i8*, i8** %6
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %28, i32** %19
%29 = load i32*, i32** %19
%30 = load i32, i32* %7
%31 = load i32, i32* @SEEK_SET
%32 = call i32 @fseek(i32* %29, i32 %30, i32 %31)
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%34 = load i32*, i32** %19
%35 = call i32 @fgets(i8* %33, i32 99, i32* %34)
%36 = load i32*, i32** %19
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 100
%39 = load i32, i32* @SEEK_SET
%40 = call i32 @fseek(i32* %36, i32 %38, i32 %39)
%41 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%42 = load i32*, i32** %19
%43 = call i32 @fgets(i8* %41, i32 8, i32* %42)
%44 = load i32*, i32** %19
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 108
%47 = load i32, i32* @SEEK_SET
%48 = call i32 @fseek(i32* %44, i32 %46, i32 %47)
%49 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%50 = load i32*, i32** %19
%51 = call i32 @fgets(i8* %49, i32 8, i32* %50)
%52 = load i32*, i32** %19
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 116
%55 = load i32, i32* @SEEK_SET
%56 = call i32 @fseek(i32* %52, i32 %54, i32 %55)
%57 = getelementptr inbounds [8 x i8], [8 x i8]* %14, i64 0, i64 0
%58 = load i32*, i32** %19
%59 = call i32 @fgets(i8* %57, i32 8, i32* %58)
%60 = load i32*, i32** %19
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 124
%63 = load i32, i32* @SEEK_SET
%64 = call i32 @fseek(i32* %60, i32 %62, i32 %63)
%65 = getelementptr inbounds [12 x i8], [12 x i8]* %15, i64 0, i64 0
%66 = load i32*, i32** %19
%67 = call i32 @fgets(i8* %65, i32 12, i32* %66)
%68 = load i32*, i32** %19
%69 = load i32, i32* %7
%70 = add nsw i32 %69, 136
%71 = load i32, i32* @SEEK_SET
%72 = call i32 @fseek(i32* %68, i32 %70, i32 %71)
%73 = getelementptr inbounds [12 x i8], [12 x i8]* %16, i64 0, i64 0
%74 = load i32*, i32** %19
%75 = call i32 @fgets(i8* %73, i32 12, i32* %74)
%76 = load i32*, i32** %19
%77 = load i32, i32* %7
%78 = add nsw i32 %77, 148
%79 = load i32, i32* @SEEK_SET
%80 = call i32 @fseek(i32* %76, i32 %78, i32 %79)
%81 = getelementptr inbounds [8 x i8], [8 x i8]* %17, i64 0, i64 0
%82 = load i32*, i32** %19
%83 = call i32 @fgets(i8* %81, i32 8, i32* %82)
%84 = load i32*, i32** %19
%85 = load i32, i32* %7
%86 = add nsw i32 %85, 156
%87 = load i32, i32* @SEEK_SET
%88 = call i32 @fseek(i32* %84, i32 %86, i32 %87)
%89 = getelementptr inbounds [1 x i8], [1 x i8]* %18, i64 0, i64 0
%90 = load i32*, i32** %19
%91 = call i32 @fgets(i8* %89, i32 2, i32* %90)
%92 = load i32*, i32** %19
%93 = load i32, i32* %7
%94 = add nsw i32 %93, 512
%95 = load i32, i32* @SEEK_SET
%96 = call i32 @fseek(i32* %92, i32 %94, i32 %95)
%97 = getelementptr inbounds [10000 x i8], [10000 x i8]* %20, i64 0, i64 0
%98 = load i32*, i32** %19
%99 = call i32 @fread(i8* %97, i32 10000, i32 1, i32* %98)
%100 = load i32*, i32** %19
%101 = call i32 @fclose(i32* %100)
%102 = load i32, i32* %9
%103 = icmp eq i32 %102, 1
br i1 %103, label %104, label %110
104: ; preds = %5
%105 = load i32, i32* %10
%106 = icmp eq i32 %105, 1
br i1 %106, label %107, label %110
107: ; preds = %104
%108 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %108)
br label %124
110: ; preds = %104, %5
%111 = getelementptr inbounds [12 x i8], [12 x i8]* %15, i64 0, i64 0
%112 = getelementptr inbounds [12 x i8], [12 x i8]* %22, i64 0, i64 0
%113 = call i32 @pad_str(i8* %111, i32 12, i8* %112)
%114 = getelementptr inbounds [12 x i8], [12 x i8]* %16, i64 0, i64 0
%115 = call i32 @octal_to_dec(i8* %114)
%116 = getelementptr inbounds [25 x i8], [25 x i8]* %21, i64 0, i64 0
%117 = call i32 @to_date_time(i32 %115, i8* %116)
%118 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%119 = call i32 @atoi(i8* %118)
%120 = getelementptr inbounds [12 x i8], [12 x i8]* %22, i64 0, i64 0
%121 = getelementptr inbounds [25 x i8], [25 x i8]* %21, i64 0, i64 0
%122 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %119, i8* %120, i8* %121, i8* %122)
br label %124
124: ; preds = %110, %107
%125 = getelementptr inbounds [1 x i8], [1 x i8]* %18, i64 0, i64 0
%126 = call i64 @strcmp(i8* %125, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%127 = icmp eq i64 %126, 0
br i1 %127, label %128, label %150
128: ; preds = %124
%129 = load i32, i32* %10
%130 = icmp eq i32 %129, 1
br i1 %130, label %131, label %150
131: ; preds = %128
%132 = getelementptr inbounds [1000 x i8], [1000 x i8]* %23, i64 0, i64 0
%133 = call i32 @strcat(i8* %132, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%134 = getelementptr inbounds [1000 x i8], [1000 x i8]* %23, i64 0, i64 0
%135 = call i32 @strcat(i8* %134, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%136 = getelementptr inbounds [1000 x i8], [1000 x i8]* %23, i64 0, i64 0
%137 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%138 = call i32 @strcat(i8* %136, i8* %137)
%139 = getelementptr inbounds [1000 x i8], [1000 x i8]* %23, i64 0, i64 0
%140 = call i32 @system(i8* %139)
store i32 %140, i32* %24
%141 = load i32, i32* %24
%142 = icmp eq i32 %141, 1
br i1 %142, label %143, label %145
143: ; preds = %131
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
br label %145
145: ; preds = %143, %131
%146 = getelementptr inbounds [1000 x i8], [1000 x i8]* %23, i64 0, i64 0
%147 = getelementptr inbounds [1000 x i8], [1000 x i8]* %23, i64 0, i64 0
%148 = call i32 @strlen(i8* %147)
%149 = call i32 @memset(i8* %146, i32 0, i32 %148)
br label %150
150: ; preds = %145, %128, %124
%151 = getelementptr inbounds [1 x i8], [1 x i8]* %18, i64 0, i64 0
%152 = call i64 @strcmp(i8* %151, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%153 = icmp eq i64 %152, 0
br i1 %153, label %154, label %190
154: ; preds = %150
%155 = load i32, i32* %10
%156 = icmp eq i32 %155, 1
br i1 %156, label %157, label %190
157: ; preds = %154
%158 = load i32, i32* %8
%159 = icmp eq i32 %158, 1
br i1 %159, label %164, label %160
160: ; preds = %157
%161 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%162 = call i32 @file_exists(i8* %161)
%163 = icmp eq i32 %162, 1
br i1 %163, label %164, label %189
164: ; preds = %160, %157
%165 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%166 = call i32* @fopen(i8* %165, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
store i32* %166, i32** %25
%167 = getelementptr inbounds [10000 x i8], [10000 x i8]* %20, i64 0, i64 0
%168 = call i32 @strlen(i8* %167)
store i32 %168, i32* %26
%169 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%170 = call i64 @strstr(i8* %169, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%171 = icmp ne i64 %170, 0
br i1 %171, label %172, label %175
172: ; preds = %164
%173 = getelementptr inbounds [10000 x i8], [10000 x i8]* %20, i64 0, i64 0
%174 = call i32 @get_gif_length(i8* %173)
store i32 %174, i32* %26
br label %175
175: ; preds = %172, %164
%176 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%177 = call i64 @strstr(i8* %176, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%178 = icmp ne i64 %177, 0
br i1 %178, label %179, label %182
179: ; preds = %175
%180 = getelementptr inbounds [10000 x i8], [10000 x i8]* %20, i64 0, i64 0
%181 = call i32 @get_png_length(i8* %180)
store i32 %181, i32* %26
br label %182
182: ; preds = %179, %175
%183 = getelementptr inbounds [10000 x i8], [10000 x i8]* %20, i64 0, i64 0
%184 = load i32, i32* %26
%185 = load i32*, i32** %25
%186 = call i32 @fwrite(i8* %183, i32 %184, i32 1, i32* %185)
%187 = load i32*, i32** %25
%188 = call i32 @fclose(i32* %187)
br label %189
189: ; preds = %182, %160
br label %190
190: ; preds = %189, %154, %150
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@SEEK_SET = global i32 0
@.str.2 = [24 x i8] c"%d %s %s %s\0A\00"
@.str.3 = [2 x i8] c"5\00"
@.str.4 = [7 x i8] c"mkdir \00"
@.str.5 = [4 x i8] c"-p \00"
@.str.7 = [2 x i8] c"0\00"
@.str.8 = [3 x i8] c"wb\00"
@.str.9 = [5 x i8] c".gif\00"
@.str.10 = [5 x i8] c".png\00"
@str = [49 x i8] c"tarino-native: Exit code from system call was 1.\00"
define void @extract_entry(i8* nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca [100 x i8]
%7 = alloca [8 x i8]
%8 = alloca [8 x i8]
%9 = alloca [8 x i8]
%10 = alloca [12 x i8]
%11 = alloca [12 x i8]
%12 = alloca [8 x i8]
%13 = alloca [1 x i8]
%14 = alloca [10000 x i8]
%15 = alloca [25 x i8]
%16 = alloca [12 x i8]
%17 = alloca [1000 x i8]
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%19 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%21 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%22 = getelementptr inbounds [12 x i8], [12 x i8]* %10, i64 0, i64 0
%23 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 0
%24 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%25 = getelementptr inbounds [1 x i8], [1 x i8]* %13, i64 0, i64 0
%26 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%27 = load i32, i32* @SEEK_SET
%28 = tail call i32 @fseek(i32* %26, i32 %1, i32 %27)
%29 = call i32 @fgets(i8* %18, i32 99, i32* %26)
%30 = add nsw i32 %1, 100
%31 = load i32, i32* @SEEK_SET
%32 = call i32 @fseek(i32* %26, i32 %30, i32 %31)
%33 = call i32 @fgets(i8* %19, i32 8, i32* %26)
%34 = add nsw i32 %1, 108
%35 = load i32, i32* @SEEK_SET
%36 = call i32 @fseek(i32* %26, i32 %34, i32 %35)
%37 = call i32 @fgets(i8* %20, i32 8, i32* %26)
%38 = add nsw i32 %1, 116
%39 = load i32, i32* @SEEK_SET
%40 = call i32 @fseek(i32* %26, i32 %38, i32 %39)
%41 = call i32 @fgets(i8* %21, i32 8, i32* %26)
%42 = add nsw i32 %1, 124
%43 = load i32, i32* @SEEK_SET
%44 = call i32 @fseek(i32* %26, i32 %42, i32 %43)
%45 = call i32 @fgets(i8* %22, i32 12, i32* %26)
%46 = add nsw i32 %1, 136
%47 = load i32, i32* @SEEK_SET
%48 = call i32 @fseek(i32* %26, i32 %46, i32 %47)
%49 = call i32 @fgets(i8* %23, i32 12, i32* %26)
%50 = add nsw i32 %1, 148
%51 = load i32, i32* @SEEK_SET
%52 = call i32 @fseek(i32* %26, i32 %50, i32 %51)
%53 = call i32 @fgets(i8* %24, i32 8, i32* %26)
%54 = add nsw i32 %1, 156
%55 = load i32, i32* @SEEK_SET
%56 = call i32 @fseek(i32* %26, i32 %54, i32 %55)
%57 = call i32 @fgets(i8* %25, i32 2, i32* %26)
%58 = getelementptr inbounds [10000 x i8], [10000 x i8]* %14, i64 0, i64 0
%59 = add nsw i32 %1, 512
%60 = load i32, i32* @SEEK_SET
%61 = call i32 @fseek(i32* %26, i32 %59, i32 %60)
%62 = call i32 @fread(i8* %58, i32 10000, i32 1, i32* %26)
%63 = call i32 @fclose(i32* %26)
%64 = icmp eq i32 %3, 1
%65 = icmp eq i32 %4, 1
%66 = and i1 %64, %65
br i1 %66, label %67, label %69
67: ; preds = %5
%68 = call i32 @puts(i8* %18)
br label %77
69: ; preds = %5
%70 = getelementptr inbounds [25 x i8], [25 x i8]* %15, i64 0, i64 0
%71 = getelementptr inbounds [12 x i8], [12 x i8]* %16, i64 0, i64 0
%72 = call i32 @pad_str(i8* %22, i32 12, i8* %71)
%73 = call i32 @octal_to_dec(i8* %23)
%74 = call i32 @to_date_time(i32 %73, i8* %70)
%75 = call i32 @atoi(i8* %19)
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %75, i8* %71, i8* %70, i8* %18)
br label %77
77: ; preds = %69, %67
%78 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%79 = icmp eq i64 %78, 0
%80 = and i1 %65, %79
br i1 %80, label %81, label %93
81: ; preds = %77
%82 = getelementptr inbounds [1000 x i8], [1000 x i8]* %17, i64 0, i64 0
%83 = call i32 @strcat(i8* %82, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%84 = call i32 @strcat(i8* %82, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%85 = call i32 @strcat(i8* %82, i8* %18)
%86 = call i32 @system(i8* %82)
%87 = icmp eq i32 %86, 1
br i1 %87, label %88, label %90
88: ; preds = %81
%89 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
br label %90
90: ; preds = %88, %81
%91 = call i32 @strlen(i8* %82)
%92 = call i32 @memset(i8* %82, i32 0, i32 %91)
br label %93
93: ; preds = %90, %77
%94 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%95 = icmp eq i64 %94, 0
%96 = and i1 %65, %95
br i1 %96, label %97, label %119
97: ; preds = %93
%98 = icmp eq i32 %2, 1
br i1 %98, label %102, label %99
99: ; preds = %97
%100 = call i32 @file_exists(i8* %18)
%101 = icmp eq i32 %100, 1
br i1 %101, label %102, label %119
102: ; preds = %99, %97
%103 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%104 = call i32 @strlen(i8* %58)
%105 = call i64 @strstr(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%106 = icmp eq i64 %105, 0
br i1 %106, label %109, label %107
107: ; preds = %102
%108 = call i32 @get_gif_length(i8* %58)
br label %109
109: ; preds = %107, %102
%110 = phi i32 [ %108, %107 ], [ %104, %102 ]
%111 = call i64 @strstr(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%112 = icmp eq i64 %111, 0
br i1 %112, label %115, label %113
113: ; preds = %109
%114 = call i32 @get_png_length(i8* %58)
br label %115
115: ; preds = %113, %109
%116 = phi i32 [ %114, %113 ], [ %110, %109 ]
%117 = call i32 @fwrite(i8* %58, i32 %116, i32 1, i32* %103)
%118 = call i32 @fclose(i32* %103)
br label %119
119: ; preds = %99, %115, %93
ret void
}