#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ untar(int /*<<< orphan*/ *, char *);
int main(int argc, char **argv) {
  FILE *a;
  ++argv;
  for (; *argv != NULL; ++argv) {
    a = fopen(*argv, "rb");
    if (a == NULL)
      fprintf(stderr, "Unable to open %s\n", *argv);
    else {
      untar(a, *argv);
      fclose(a);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     11e2 <main+0xa2>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe82(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11b3 <main+0x73>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe5a(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11cc <main+0x8c>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1040 <untar@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
jmp    11d1 <main+0x91>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1162 <main+0x22>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     11b1 <main+0x71>
mov    %rsi,%rbx
add    $0x8,%rbx
lea    0xea0(%rip),%r14
mov    0x2e79(%rip),%r13
lea    0xe95(%rip),%r15
jmp    1193 <main+0x53>
mov    %rax,%r12
mov    (%rbx),%rsi
mov    %rax,%rdi
call   1040 <untar@plt>
mov    %r12,%rdi
call   1030 <fclose@plt>
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     11b1 <main+0x71>
mov    %r14,%rsi
call   1060 <fopen@plt>
test   %rax,%rax
jne    1170 <main+0x30>
mov    0x0(%r13),%edi
mov    (%rbx),%rdx
mov    %r15,%rsi
call   1050 <fprintf@plt>
jmp    1186 <main+0x46>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.1 = [19 x i8] c"Unable to open %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i32 1
store i8** %8, i8*** %5
br label %9
9: ; preds = %32, %2
%10 = load i8**, i8*** %5
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %35
13: ; preds = %9
%14 = load i8**, i8*** %5
%15 = load i8*, i8** %14
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %6
%17 = load i32*, i32** %6
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %24
19: ; preds = %13
%20 = load i32, i32* @stderr
%21 = load i8**, i8*** %5
%22 = load i8*, i8** %21
%23 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %31
24: ; preds = %13
%25 = load i32*, i32** %6
%26 = load i8**, i8*** %5
%27 = load i8*, i8** %26
%28 = call i32 @untar(i32* %25, i8* %27)
%29 = load i32*, i32** %6
%30 = call i32 @fclose(i32* %29)
br label %31
31: ; preds = %24, %19
br label %32
32: ; preds = %31
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i32 1
store i8** %34, i8*** %5
br label %9
35: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.1 = [19 x i8] c"Unable to open %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %23, label %6
6: ; preds = %2, %19
%7 = phi i8* [ %21, %19 ], [ %4, %2 ]
%8 = phi i8** [ %20, %19 ], [ %3, %2 ]
%9 = tail call i32* @fopen(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %8
%14 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %19
15: ; preds = %6
%16 = load i8*, i8** %8
%17 = tail call i32 @untar(i32* %9, i8* %16)
%18 = tail call i32 @fclose(i32* %9)
br label %19
19: ; preds = %11, %15
%20 = getelementptr inbounds i8*, i8** %8, i64 1
%21 = load i8*, i8** %20
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %6
23: ; preds = %19, %2
ret i32 0
}