#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*/ errno;
int getopt(int, char **, char *);
scalar_t__ opterr;
int optind;
int /*<<< orphan*/ printf(char *, char *, ...);
char *strerror(int /*<<< orphan*/);
int unlink(char *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  int result;
  int c;
  opterr = 0;
  while ((c = getopt(argc, argv, "h")) != -1) {
    switch (c) {
    case 'h':
    default:
      usage();
      break;
    }
  }
  while (optind < argc) {
    printf("Attempting to unlink %s\n", argv[optind]);
    result = unlink(argv[optind]);
    if (result < 0) {
      printf("Error unlinking %s: %s\n", argv[optind], strerror(errno));
      break;
    }
    optind++;
  }
  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    0x2e63(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe7e(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     11b5 <main+0x65>
mov    -0x18(%rbp),%eax
sub    $0x68,%eax
jne    11a9 <main+0x59>
jmp    11a4 <main+0x54>
jmp    11a9 <main+0x59>
mov    $0x0,%al
call   1050 <usage@plt>
jmp    1174 <main+0x24>
jmp    11ba <main+0x6a>
mov    0x2e27(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1268 <main+0x118>
mov    -0x10(%rbp),%rax
mov    0x2e11(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x2df1(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <unlink@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    124e <main+0xfe>
mov    -0x10(%rbp),%rax
mov    0x2dcd(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1268 <main+0x118>
mov    0x2d93(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    0x2d87(%rip),%rax
mov    %ecx,(%rax)
jmp    11ba <main+0x6a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e6d(%rip),%rax
movq   $0x0,(%rax)
lea    0xe8f(%rip),%rdx
call   1060 <getopt@plt>
cmp    $0xffffffff,%eax
je     11a9 <main+0x59>
lea    0xe7e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <usage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
cmp    $0xffffffff,%eax
jne    1190 <main+0x40>
mov    0x2e38(%rip),%r15
mov    (%r15),%ecx
cmp    %ebp,%ecx
jge    1216 <main+0xc6>
lea    0xe44(%rip),%r14
xchg   %ax,%ax
movslq %ecx,%rax
mov    (%rbx,%rax,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq (%r15),%rax
mov    (%rbx,%rax,8),%rdi
call   1030 <unlink@plt>
movslq (%r15),%rcx
test   %eax,%eax
js     11f0 <main+0xa0>
add    $0x1,%ecx
mov    %ecx,(%r15)
cmp    %ebp,%ecx
jl     11c0 <main+0x70>
jmp    1216 <main+0xc6>
mov    (%rbx,%rcx,8),%rbx
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe12(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@opterr = global i64 0
@.str = [2 x i8] c"h\00"
@optind = global i32 0
@.str.1 = [25 x i8] c"Attempting to unlink %s\0A\00"
@.str.2 = [24 x i8] c"Error unlinking %s: %s\0A\00"
@errno = global i32 0
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 i64 0, i64* @opterr
br label %8
8: ; preds = %18, %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %7
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %19
13: ; preds = %8
%14 = load i32, i32* %7
switch i32 %14, label %16 [
i32 104, label %15
]
15: ; preds = %13
br label %16
16: ; preds = %13, %15
%17 = call i32 (...) @usage()
br label %18
18: ; preds = %16
br label %8
19: ; preds = %8
br label %20
20: ; preds = %48, %19
%21 = load i32, i32* @optind
%22 = load i32, i32* %4
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %51
24: ; preds = %20
%25 = load i8**, i8*** %5
%26 = load i32, i32* @optind
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = load i8**, i8*** %5
%32 = load i32, i32* @optind
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %31, i64 %33
%35 = load i8*, i8** %34
%36 = call i32 @unlink(i8* %35)
store i32 %36, i32* %6
%37 = load i32, i32* %6
%38 = icmp slt i32 %37, 0
br i1 %38, label %39, label %48
39: ; preds = %24
%40 = load i8**, i8*** %5
%41 = load i32, i32* @optind
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = load i32, i32* @errno
%46 = call i8* @strerror(i32 %45)
%47 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %44, i8* %46)
br label %51
48: ; preds = %24
%49 = load i32, i32* @optind
%50 = add nsw i32 %49, 1
store i32 %50, i32* @optind
br label %20
51: ; preds = %39, %20
ret i32 0
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [2 x i8] c"h\00"
@optind = global i32 0
@.str.1 = [25 x i8] c"Attempting to unlink %s\0A\00"
@.str.2 = [24 x i8] c"Error unlinking %s: %s\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
store i64 0, i64* @opterr
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %8, %2
%6 = load i32, i32* @optind
%7 = icmp slt i32 %6, %0
br i1 %7, label %12, label %35
8: ; preds = %2, %8
%9 = tail call i32 (...) @usage()
%10 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32 %10, -1
br i1 %11, label %5, label %8
12: ; preds = %5, %32
%13 = phi i32 [ %33, %32 ], [ %6, %5 ]
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @optind
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %1, i64 %19
%21 = load i8*, i8** %20
%22 = tail call i32 @unlink(i8* %21)
%23 = icmp slt i32 %22, 0
%24 = load i32, i32* @optind
br i1 %23, label %25, label %32
25: ; preds = %12
%26 = sext i32 %24 to i64
%27 = getelementptr inbounds i8*, i8** %1, i64 %26
%28 = load i8*, i8** %27
%29 = load i32, i32* @errno
%30 = tail call i8* @strerror(i32 %29)
%31 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %28, i8* %30)
br label %35
32: ; preds = %12
%33 = add nsw i32 %24, 1
store i32 %33, i32* @optind
%34 = icmp slt i32 %33, %0
br i1 %34, label %12, label %35
35: ; preds = %32, %5, %25
ret i32 0
}