#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*/ ClearNames();
scalar_t__ FindResourceFile(char *);
int /*<<< orphan*/ NewName(char *);
int /*<<< orphan*/ dousage();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int i, ret = 0;
  if (argc == 1)
    dousage();
  for (i = 1; i < argc; ++i) {
    if (*argv[i] == '-')
      NewName(argv[i]);
    else if (FindResourceFile(argv[i]))
      ClearNames();
    else {
      fprintf(stderr, "Can't find an appropriate resource fork in %s\n",
              argv[i]);
      ret = 1;
    }
  }
  return (ret);
}


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)
movl   $0x0,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    117e <main+0x2e>
mov    $0x0,%al
call   1030 <dousage@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1226 <main+0xd6>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11bf <main+0x6f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <NewName@plt>
jmp    1213 <main+0xc3>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <FindResourceFile@plt>
cmp    $0x0,%rax
je     11e6 <main+0x96>
mov    $0x0,%al
call   1070 <ClearNames@plt>
jmp    120e <main+0xbe>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdfe(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x18(%rbp)
jmp    1213 <main+0xc3>
jmp    1218 <main+0xc8>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1185 <main+0x35>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r15d,%r15d
cmp    $0x1,%edi
jne    116c <main+0x1c>
xor    %eax,%eax
call   1030 <dousage@plt>
jmp    11d2 <main+0x82>
cmp    $0x2,%edi
jl     11d2 <main+0x82>
mov    %rsi,%rbx
mov    %edi,%r12d
mov    $0x1,%ebp
mov    0x2e5d(%rip),%r13
lea    0xe76(%rip),%r14
xor    %r15d,%r15d
jmp    119e <main+0x4e>
nop
call   1050 <NewName@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
je     11d2 <main+0x82>
mov    (%rbx,%rbp,8),%rdi
cmpb   $0x2d,(%rdi)
je     1190 <main+0x40>
call   1060 <FindResourceFile@plt>
test   %rax,%rax
je     11ba <main+0x6a>
xor    %eax,%eax
call   1070 <ClearNames@plt>
jmp    1195 <main+0x45>
mov    0x0(%r13),%edi
mov    (%rbx,%rbp,8),%rdx
mov    %r14,%rsi
call   1040 <fprintf@plt>
mov    $0x1,%r15d
jmp    1195 <main+0x45>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [47 x i8] c"Can't find an appropriate resource fork in %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @dousage()
br label %12
12: ; preds = %10, %2
store i32 1, i32* %6
br label %13
13: ; preds = %53, %12
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %56
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 45
br i1 %25, label %26, label %33
26: ; preds = %17
%27 = load i8**, i8*** %5
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = call i32 @NewName(i8* %31)
br label %52
33: ; preds = %17
%34 = load i8**, i8*** %5
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i64 @FindResourceFile(i8* %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %33
%42 = call i32 (...) @ClearNames()
br label %51
43: ; preds = %33
%44 = load i32, i32* @stderr
%45 = load i8**, i8*** %5
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %49)
store i32 1, i32* %7
br label %51
51: ; preds = %43, %41
br label %52
52: ; preds = %51, %26
br label %53
53: ; preds = %52
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
store i32 %55, i32* %6
br label %13
56: ; preds = %13
%57 = load i32, i32* %7
ret i32 %57
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [47 x i8] c"Can't find an appropriate resource fork in %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @dousage()
br label %32
6: ; preds = %2
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %32
8: ; preds = %6
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %8, %28
%11 = phi i64 [ 1, %8 ], [ %30, %28 ]
%12 = phi i32 [ 0, %8 ], [ %29, %28 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %11
%14 = load i8*, i8** %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 45
br i1 %16, label %17, label %19
17: ; preds = %10
%18 = tail call i32 @NewName(i8* %14)
br label %28
19: ; preds = %10
%20 = tail call i64 @FindResourceFile(i8* %14)
%21 = icmp eq i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %19
%23 = tail call i32 (...) @ClearNames()
br label %28
24: ; preds = %19
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %13
%27 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %17, %24, %22
%29 = phi i32 [ %12, %17 ], [ %12, %22 ], [ 1, %24 ]
%30 = add nuw nsw i64 %11, 1
%31 = icmp eq i64 %30, %9
br i1 %31, label %32, label %10
32: ; preds = %28, %4, %6
%33 = phi i32 [ 0, %6 ], [ 0, %4 ], [ %29, %28 ]
ret i32 %33
}