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

/* Variables and functions */
int /*<<< orphan*/ extract_all_files();
int /*<<< orphan*/ extract_file(int);
int find_file(char *);
void extract_files(int argc, char *argv[]) {
  int i, lp;
  if (argc == 3)
    extract_all_files();
  else {
    for (i = 3; i < argc; i += 1) {
      lp = find_file(argv[i]);
      extract_file(lp);
    }
  }
}


x86 assembly (clang, -O0):
<extract_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x4(%rbp)
jne    1155 <extract_files+0x25>
mov    $0x0,%al
call   1050 <extract_all_files@plt>
jmp    1197 <extract_files+0x67>
movl   $0x3,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1192 <extract_files+0x62>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <find_file@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <extract_file@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115c <extract_files+0x2c>
jmp    1197 <extract_files+0x67>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_files>:
cmp    $0x3,%edi
jne    113c <extract_files+0xc>
xor    %eax,%eax
jmp    1050 <extract_all_files@plt>
push   %r15
push   %r14
push   %rbx
jle    1169 <extract_files+0x39>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x3,%ebx
xchg   %ax,%ax
mov    (%r14,%rbx,8),%rdi
call   1040 <find_file@plt>
mov    %eax,%edi
call   1030 <extract_file@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1150 <extract_files+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @extract_files(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 3
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @extract_all_files()
br label %29
11: ; preds = %2
store i32 3, i32* %5
br label %12
12: ; preds = %25, %11
%13 = load i32, i32* %5
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %28
16: ; preds = %12
%17 = load i8**, i8*** %4
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = call i32 @find_file(i8* %21)
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = call i32 @extract_file(i32 %23)
br label %25
25: ; preds = %16
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %12
28: ; preds = %12
br label %29
29: ; preds = %28, %9
ret void
}

LLVM IR (-O2):
define void @extract_files(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = icmp sgt i32 %0, 3
br i1 %5, label %6, label %18
6: ; preds = %4
%7 = zext i32 %0 to i64
br label %10
8: ; preds = %2
%9 = tail call i32 (...) @extract_all_files()
br label %18
10: ; preds = %6, %10
%11 = phi i64 [ 3, %6 ], [ %16, %10 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i32 @find_file(i8* %13)
%15 = tail call i32 @extract_file(i32 %14)
%16 = add nuw nsw i64 %11, 1
%17 = icmp eq i64 %16, %7
br i1 %17, label %18, label %10
18: ; preds = %10, %4, %8
ret void
}