#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*/ create_dir(char *, int);
int /*<<< orphan*/ *create_file(char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
size_t fread(char *, int, int, int /*<<< orphan*/ *);
size_t fwrite(char *, int, size_t, int /*<<< orphan*/ *);
scalar_t__ is_end_of_archive(char *);
int parseoct(char *, int);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ verify_checksum(char *);
void untar(FILE *a, const char *path) {
  char buff[512];
  FILE *f = NULL;
  size_t bytes_read;
  int filesize;
  printf("Extracting from %s\n", path);
  for (;;) {
    bytes_read = fread(buff, 1, 512, a);
    if (bytes_read < 512) {
      fprintf(stderr, "Short read on %s: expected 512, got %d\n", path,
              bytes_read);
      return;
    }
    if (is_end_of_archive(buff)) {
      printf("End of %s\n", path);
      return;
    }
    if (!verify_checksum(buff)) {
      fprintf(stderr, "Checksum failure\n");
      return;
    }
    filesize = parseoct(buff + 124, 12);
    switch (buff[156]) {
    case '1':
      printf(" Ignoring hardlink %s\n", buff);
      break;
    case '2':
      printf(" Ignoring symlink %s\n", buff);
      break;
    case '3':
      printf(" Ignoring character device %s\n", buff);
      break;
    case '4':
      printf(" Ignoring block device %s\n", buff);
      break;
    case '5':
      printf(" Extracting dir %s\n", buff);
      create_dir(buff, parseoct(buff + 100, 8));
      filesize = 0;
      break;
    case '6':
      printf(" Ignoring FIFO %s\n", buff);
      break;
    default:
      printf(" Extracting file %s\n", buff);
      f = create_file(buff, parseoct(buff + 100, 8));
      break;
    }
    while (filesize > 0) {
      bytes_read = fread(buff, 1, 512, a);
      if (bytes_read < 512) {
        fprintf(stderr, "Short read on %s: Expected 512, got %d\n", path,
                bytes_read);
        return;
      }
      if (filesize < 512)
        bytes_read = filesize;
      if (f != NULL) {
        if (fwrite(buff, 1, bytes_read, f) != bytes_read) {
          fprintf(stderr, "Failed write\n");
          fclose(f);
          f = NULL;
        }
      }
      filesize -= bytes_read;
    }
    if (f != NULL) {
      fclose(f);
      f = NULL;
    }
  }
}


x86 assembly (clang, -O0):
<untar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x218(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe4f(%rip),%rdi
call   1050 <printf@plt>
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x200,%edx
call   1030 <fread@plt>
mov    %rax,-0x220(%rbp)
cmpq   $0x200,-0x220(%rbp)
jae    1227 <untar+0x87>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x220(%rbp),%rcx
lea    0xe11(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    151f <untar+0x37f>
lea    -0x210(%rbp),%rdi
call   1080 <is_end_of_archive@plt>
cmp    $0x0,%rax
je     1252 <untar+0xb2>
mov    -0x10(%rbp),%rsi
lea    0xe0c(%rip),%rdi
call   1050 <printf@plt>
jmp    151f <untar+0x37f>
lea    -0x210(%rbp),%rdi
call   1090 <verify_checksum@plt>
cmp    $0x0,%eax
jne    1283 <untar+0xe3>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
lea    0xde8(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    151f <untar+0x37f>
lea    -0x194(%rbp),%rdi
mov    $0xc,%esi
call   10c0 <parseoct@plt>
mov    %eax,-0x224(%rbp)
movsbl -0x174(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x230(%rbp)
sub    $0x5,%eax
ja     1398 <untar+0x1f8>
mov    -0x230(%rbp),%rax
lea    0xd3c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x210(%rbp),%rsi
lea    0xd96(%rip),%rdi
call   1050 <printf@plt>
jmp    13e3 <untar+0x243>
lea    -0x210(%rbp),%rsi
lea    0xd95(%rip),%rdi
call   1050 <printf@plt>
jmp    13e3 <untar+0x243>
lea    -0x210(%rbp),%rsi
lea    0xd93(%rip),%rdi
call   1050 <printf@plt>
jmp    13e3 <untar+0x243>
lea    -0x210(%rbp),%rsi
lea    0xd9a(%rip),%rdi
call   1050 <printf@plt>
jmp    13e3 <untar+0x243>
lea    -0x210(%rbp),%rsi
lea    0xd9d(%rip),%rdi
call   1050 <printf@plt>
lea    -0x210(%rbp),%rax
mov    %rax,-0x238(%rbp)
lea    -0x210(%rbp),%rdi
add    $0x64,%rdi
mov    $0x8,%esi
call   10c0 <parseoct@plt>
mov    -0x238(%rbp),%rdi
mov    %eax,%esi
call   1070 <create_dir@plt>
movl   $0x0,-0x224(%rbp)
jmp    13e3 <untar+0x243>
lea    -0x210(%rbp),%rsi
lea    0xd5e(%rip),%rdi
call   1050 <printf@plt>
jmp    13e3 <untar+0x243>
lea    -0x210(%rbp),%rsi
lea    0xd59(%rip),%rdi
call   1050 <printf@plt>
lea    -0x210(%rbp),%rax
mov    %rax,-0x240(%rbp)
lea    -0x210(%rbp),%rdi
add    $0x64,%rdi
mov    $0x8,%esi
call   10c0 <parseoct@plt>
mov    -0x240(%rbp),%rdi
mov    %eax,%esi
call   10a0 <create_file@plt>
mov    %rax,-0x218(%rbp)
jmp    13e8 <untar+0x248>
cmpl   $0x0,-0x224(%rbp)
jle    14f5 <untar+0x355>
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x200,%edx
call   1030 <fread@plt>
mov    %rax,-0x220(%rbp)
cmpq   $0x200,-0x220(%rbp)
jae    144e <untar+0x2ae>
mov    0x2bb2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x220(%rbp),%rcx
lea    0xcd2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    151f <untar+0x37f>
cmpl   $0x200,-0x224(%rbp)
jge    146c <untar+0x2cc>
movslq -0x224(%rbp),%rax
mov    %rax,-0x220(%rbp)
cmpq   $0x0,-0x218(%rbp)
je     14d9 <untar+0x339>
lea    -0x210(%rbp),%rdi
mov    -0x220(%rbp),%rdx
mov    -0x218(%rbp),%rcx
mov    $0x1,%esi
call   10b0 <fwrite@plt>
cmp    -0x220(%rbp),%rax
je     14d4 <untar+0x334>
mov    0x2b33(%rip),%rax
mov    (%rax),%edi
lea    0xc86(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x218(%rbp),%rdi
call   1040 <fclose@plt>
movq   $0x0,-0x218(%rbp)
jmp    14d9 <untar+0x339>
mov    -0x220(%rbp),%rcx
movslq -0x224(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x224(%rbp)
jmp    13e8 <untar+0x248>
cmpq   $0x0,-0x218(%rbp)
je     151a <untar+0x37a>
mov    -0x218(%rbp),%rdi
call   1040 <fclose@plt>
movq   $0x0,-0x218(%rbp)
jmp    11ce <untar+0x2e>
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<untar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x208,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe5a(%rip),%rdi
call   1050 <printf@plt>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
cmp    $0x200,%rax
jae    11fb <untar+0x5b>
mov    0x2df9(%rip),%rcx
mov    (%rcx),%edi
lea    0xe3c(%rip),%rsi
mov    %r14,%rdx
mov    %rax,%rcx
jmp    13b9 <untar+0x219>
mov    %rsp,%r13
mov    %r13,%rdi
call   1080 <is_end_of_archive@plt>
test   %rax,%rax
jne    13d2 <untar+0x232>
mov    %r13,%rdi
call   1090 <verify_checksum@plt>
test   %eax,%eax
je     13e3 <untar+0x243>
lea    0x7c(%rsp),%rdi
mov    $0xc,%esi
call   10c0 <parseoct@plt>
mov    %eax,%r12d
movsbl 0x9c(%rsp),%eax
add    $0xffffffcf,%eax
cmp    $0x5,%eax
ja     125d <untar+0xbd>
lea    0xdb8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe19(%rip),%rdi
jmp    12e0 <untar+0x140>
lea    0xe9b(%rip),%rdi
mov    %r13,%rsi
call   1050 <printf@plt>
lea    0x64(%rsp),%rdi
mov    $0x8,%esi
call   10c0 <parseoct@plt>
mov    %r13,%rdi
mov    %eax,%esi
call   10a0 <create_file@plt>
mov    %rax,%r15
jmp    12f6 <untar+0x156>
lea    0xdf7(%rip),%rdi
jmp    12e0 <untar+0x140>
lea    0xe04(%rip),%rdi
jmp    12e0 <untar+0x140>
lea    0xe1a(%rip),%rdi
jmp    12e0 <untar+0x140>
lea    0xe2c(%rip),%rdi
mov    %r13,%rsi
call   1050 <printf@plt>
lea    0x64(%rsp),%rdi
mov    $0x8,%esi
call   10c0 <parseoct@plt>
mov    %r13,%rdi
mov    %eax,%esi
call   1070 <create_dir@plt>
jmp    137d <untar+0x1dd>
lea    0xe13(%rip),%rdi
nopl   0x0(%rax)
mov    %r13,%rsi
call   1050 <printf@plt>
xor    %r15d,%r15d
jmp    12f6 <untar+0x156>
nopl   (%rax)
xor    %r15d,%r15d
sub    %ebp,%r12d
test   %r12d,%r12d
jle    1370 <untar+0x1d0>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
mov    %rax,%rbp
cmp    $0x1ff,%rax
jbe    13a3 <untar+0x203>
cmp    $0x200,%r12d
mov    %r12d,%eax
cmovb  %rax,%rbp
test   %r15,%r15
je     12f0 <untar+0x150>
mov    %r13,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
mov    %r15,%rcx
call   10b0 <fwrite@plt>
cmp    %rbp,%rax
je     12f3 <untar+0x153>
mov    0x2c8f(%rip),%rax
mov    (%rax),%edi
lea    0xde2(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
jmp    12f0 <untar+0x150>
nopl   0x0(%rax,%rax,1)
test   %r15,%r15
je     137d <untar+0x1dd>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
cmp    $0x200,%rax
jae    11fe <untar+0x5e>
jmp    11e0 <untar+0x40>
mov    0x2c36(%rip),%rax
mov    (%rax),%edi
lea    0xd61(%rip),%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc7b(%rip),%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
jmp    13c0 <untar+0x220>
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
lea    0xc6c(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    13c0 <untar+0x220>

LLVM IR (-O0):
@.str = [20 x i8] c"Extracting from %s\0A\00"
@stderr = global i32 0
@.str.1 = [40 x i8] c"Short read on %s: expected 512, got %d\0A\00"
@.str.2 = [11 x i8] c"End of %s\0A\00"
@.str.3 = [18 x i8] c"Checksum failure\0A\00"
@.str.4 = [23 x i8] c" Ignoring hardlink %s\0A\00"
@.str.5 = [22 x i8] c" Ignoring symlink %s\0A\00"
@.str.6 = [31 x i8] c" Ignoring character device %s\0A\00"
@.str.7 = [27 x i8] c" Ignoring block device %s\0A\00"
@.str.8 = [20 x i8] c" Extracting dir %s\0A\00"
@.str.9 = [19 x i8] c" Ignoring FIFO %s\0A\00"
@.str.10 = [21 x i8] c" Extracting file %s\0A\00"
@.str.11 = [40 x i8] c"Short read on %s: Expected 512, got %d\0A\00"
@.str.12 = [14 x i8] c"Failed write\0A\00"
define void @untar(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca [512 x i8]
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
store i32* null, i32** %6
%9 = load i8*, i8** %4
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %123, %2
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%13 = load i32*, i32** %3
%14 = call i64 @fread(i8* %12, i32 1, i32 512, i32* %13)
store i64 %14, i64* %7
%15 = load i64, i64* %7
%16 = icmp ult i64 %15, 512
br i1 %16, label %17, label %22
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %4
%20 = load i64, i64* %7
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %19, i64 %20)
br label %124
22: ; preds = %11
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%24 = call i64 @is_end_of_archive(i8* %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i8*, i8** %4
%28 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %27)
br label %124
29: ; preds = %22
%30 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%31 = call i32 @verify_checksum(i8* %30)
%32 = icmp ne i32 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %29
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %124
36: ; preds = %29
%37 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%38 = getelementptr inbounds i8, i8* %37, i64 124
%39 = call i32 @parseoct(i8* %38, i32 12)
store i32 %39, i32* %8
%40 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 156
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
switch i32 %42, label %66 [
i32 49, label %43
i32 50, label %46
i32 51, label %49
i32 52, label %52
i32 53, label %55
i32 54, label %63
]
43: ; preds = %36
%44 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%45 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %44)
br label %74
46: ; preds = %36
%47 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%48 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %47)
br label %74
49: ; preds = %36
%50 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%51 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i8* %50)
br label %74
52: ; preds = %36
%53 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%54 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %53)
br label %74
55: ; preds = %36
%56 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%57 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %56)
%58 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%59 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%60 = getelementptr inbounds i8, i8* %59, i64 100
%61 = call i32 @parseoct(i8* %60, i32 8)
%62 = call i32 @create_dir(i8* %58, i32 %61)
store i32 0, i32* %8
br label %74
63: ; preds = %36
%64 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%65 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i8* %64)
br label %74
66: ; preds = %36
%67 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%68 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i8* %67)
%69 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%70 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%71 = getelementptr inbounds i8, i8* %70, i64 100
%72 = call i32 @parseoct(i8* %71, i32 8)
%73 = call i32* @create_file(i8* %69, i32 %72)
store i32* %73, i32** %6
br label %74
74: ; preds = %66, %63, %55, %52, %49, %46, %43
br label %75
75: ; preds = %111, %74
%76 = load i32, i32* %8
%77 = icmp sgt i32 %76, 0
br i1 %77, label %78, label %117
78: ; preds = %75
%79 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%80 = load i32*, i32** %3
%81 = call i64 @fread(i8* %79, i32 1, i32 512, i32* %80)
store i64 %81, i64* %7
%82 = load i64, i64* %7
%83 = icmp ult i64 %82, 512
br i1 %83, label %84, label %89
84: ; preds = %78
%85 = load i32, i32* @stderr
%86 = load i8*, i8** %4
%87 = load i64, i64* %7
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0), i8* %86, i64 %87)
br label %124
89: ; preds = %78
%90 = load i32, i32* %8
%91 = icmp slt i32 %90, 512
br i1 %91, label %92, label %95
92: ; preds = %89
%93 = load i32, i32* %8
%94 = sext i32 %93 to i64
store i64 %94, i64* %7
br label %95
95: ; preds = %92, %89
%96 = load i32*, i32** %6
%97 = icmp ne i32* %96, null
br i1 %97, label %98, label %111
98: ; preds = %95
%99 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%100 = load i64, i64* %7
%101 = load i32*, i32** %6
%102 = call i64 @fwrite(i8* %99, i32 1, i64 %100, i32* %101)
%103 = load i64, i64* %7
%104 = icmp ne i64 %102, %103
br i1 %104, label %105, label %110
105: ; preds = %98
%106 = load i32, i32* @stderr
%107 = call i32 (i32, i8*, ...) @fprintf(i32 %106, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0))
%108 = load i32*, i32** %6
%109 = call i32 @fclose(i32* %108)
store i32* null, i32** %6
br label %110
110: ; preds = %105, %98
br label %111
111: ; preds = %110, %95
%112 = load i64, i64* %7
%113 = load i32, i32* %8
%114 = sext i32 %113 to i64
%115 = sub i64 %114, %112
%116 = trunc i64 %115 to i32
store i32 %116, i32* %8
br label %75
117: ; preds = %75
%118 = load i32*, i32** %6
%119 = icmp ne i32* %118, null
br i1 %119, label %120, label %123
120: ; preds = %117
%121 = load i32*, i32** %6
%122 = call i32 @fclose(i32* %121)
store i32* null, i32** %6
br label %123
123: ; preds = %120, %117
br label %11
124: ; preds = %84, %33, %26, %17
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Extracting from %s\0A\00"
@stderr = global i32 0
@.str.1 = [40 x i8] c"Short read on %s: expected 512, got %d\0A\00"
@.str.2 = [11 x i8] c"End of %s\0A\00"
@.str.3 = [18 x i8] c"Checksum failure\0A\00"
@.str.4 = [23 x i8] c" Ignoring hardlink %s\0A\00"
@.str.5 = [22 x i8] c" Ignoring symlink %s\0A\00"
@.str.6 = [31 x i8] c" Ignoring character device %s\0A\00"
@.str.7 = [27 x i8] c" Ignoring block device %s\0A\00"
@.str.8 = [20 x i8] c" Extracting dir %s\0A\00"
@.str.9 = [19 x i8] c" Ignoring FIFO %s\0A\00"
@.str.10 = [21 x i8] c" Extracting file %s\0A\00"
@.str.11 = [40 x i8] c"Short read on %s: Expected 512, got %d\0A\00"
@.str.12 = [14 x i8] c"Failed write\0A\00"
define void @untar(i32* nocapture %0, i8* %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = call i64 @fread(i8* %4, i32 1, i32 512, i32* %0)
%7 = icmp ult i64 %6, 512
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 124
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 156
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 100
br label %16
12: ; preds = %82, %2
%13 = phi i64 [ %6, %2 ], [ %83, %82 ]
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %1, i64 %13)
br label %85
16: ; preds = %8, %82
%17 = call i64 @is_end_of_archive(i8* %4)
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %85
21: ; preds = %16
%22 = call i32 @verify_checksum(i8* %4)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %85
27: ; preds = %21
%28 = call i32 @parseoct(i8* %9, i32 12)
%29 = load i8, i8* %10
%30 = sext i8 %29 to i32
switch i32 %30, label %45 [
i32 49, label %31
i32 50, label %33
i32 51, label %35
i32 52, label %37
i32 53, label %39
i32 54, label %43
]
31: ; preds = %27
%32 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %4)
br label %49
33: ; preds = %27
%34 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %4)
br label %49
35: ; preds = %27
%36 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i8* %4)
br label %49
37: ; preds = %27
%38 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %4)
br label %49
39: ; preds = %27
%40 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %4)
%41 = call i32 @parseoct(i8* %11, i32 8)
%42 = call i32 @create_dir(i8* %4, i32 %41)
br label %82
43: ; preds = %27
%44 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i8* %4)
br label %49
45: ; preds = %27
%46 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i8* %4)
%47 = call i32 @parseoct(i8* %11, i32 8)
%48 = call i32* @create_file(i8* %4, i32 %47)
br label %49
49: ; preds = %45, %43, %37, %35, %33, %31
%50 = phi i32* [ %48, %45 ], [ null, %43 ], [ null, %37 ], [ null, %35 ], [ null, %33 ], [ null, %31 ]
%51 = icmp sgt i32 %28, 0
br i1 %51, label %52, label %77
52: ; preds = %49, %72
%53 = phi i32 [ %75, %72 ], [ %28, %49 ]
%54 = phi i32* [ %73, %72 ], [ %50, %49 ]
%55 = call i64 @fread(i8* %4, i32 1, i32 512, i32* %0)
%56 = icmp ult i64 %55, 512
br i1 %56, label %57, label %60
57: ; preds = %52
%58 = load i32, i32* @stderr
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0), i8* %1, i64 %55)
br label %85
60: ; preds = %52
%61 = icmp ult i32 %53, 512
%62 = zext i32 %53 to i64
%63 = select i1 %61, i64 %62, i64 %55
%64 = icmp eq i32* %54, null
br i1 %64, label %72, label %65
65: ; preds = %60
%66 = call i64 @fwrite(i8* %4, i32 1, i64 %63, i32* %54)
%67 = icmp eq i64 %66, %63
br i1 %67, label %72, label %68
68: ; preds = %65
%69 = load i32, i32* @stderr
%70 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0))
%71 = call i32 @fclose(i32* %54)
br label %72
72: ; preds = %65, %68, %60
%73 = phi i32* [ null, %68 ], [ %54, %65 ], [ null, %60 ]
%74 = trunc i64 %63 to i32
%75 = sub i32 %53, %74
%76 = icmp sgt i32 %75, 0
br i1 %76, label %52, label %77
77: ; preds = %72, %49
%78 = phi i32* [ %50, %49 ], [ %73, %72 ]
%79 = icmp eq i32* %78, null
br i1 %79, label %82, label %80
80: ; preds = %77
%81 = call i32 @fclose(i32* %78)
br label %82
82: ; preds = %39, %80, %77
%83 = call i64 @fread(i8* %4, i32 1, i32 512, i32* %0)
%84 = icmp ult i64 %83, 512
br i1 %84, label %12, label %16
85: ; preds = %57, %24, %19, %12
ret void
}