#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 EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ chdir(char *);
scalar_t__ unlink(char *);
int main(int argc, char **argv) {
  char *long_dir, *fname;
  if (3 > argc)
    return EXIT_FAILURE;
  else {
    long_dir = argv[1];
    fname = argv[2];
  }
  for (int i = 0; i < 64; i++) {
    if (0 > chdir(long_dir))
      return EXIT_FAILURE;
  }
  if (0 > unlink(fname))
    return EXIT_FAILURE;
  else
    return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x3,%eax
cmp    -0x8(%rbp),%eax
jle    1155 <main+0x35>
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ed <main+0xcd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x40,-0x24(%rbp)
jge    11b9 <main+0x99>
mov    -0x18(%rbp),%rdi
call   1040 <chdir@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    11a6 <main+0x86>
mov    0x2e44(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ed <main+0xcd>
jmp    11ab <main+0x8b>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1174 <main+0x54>
mov    -0x20(%rbp),%rdi
call   1030 <unlink@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    11e1 <main+0xc1>
mov    0x2e09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ed <main+0xcd>
mov    0x2df0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2eb2(%rip),%r15
cmp    $0x3,%edi
jl     116f <main+0x4f>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r14
mov    $0x40,%ebp
mov    %rbx,%rdi
call   1040 <chdir@plt>
test   %rax,%rax
js     116f <main+0x4f>
add    $0xffffffff,%ebp
jne    1140 <main+0x20>
mov    %r14,%rdi
call   1030 <unlink@plt>
test   %rax,%rax
jns    1168 <main+0x48>
mov    0x2e7a(%rip),%r15
jmp    116f <main+0x4f>
mov    0x2e69(%rip),%r15
mov    (%r15),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp sgt i32 3, %9
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i32, i32* @EXIT_FAILURE
store i32 %12, i32* %3
br label %42
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %6
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
store i8* %19, i8** %7
br label %20
20: ; preds = %13
store i32 0, i32* %8
br label %21
21: ; preds = %31, %20
%22 = load i32, i32* %8
%23 = icmp slt i32 %22, 64
br i1 %23, label %24, label %34
24: ; preds = %21
%25 = load i8*, i8** %6
%26 = call i64 @chdir(i8* %25)
%27 = icmp sgt i64 0, %26
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = load i32, i32* @EXIT_FAILURE
store i32 %29, i32* %3
br label %42
30: ; preds = %24
br label %31
31: ; preds = %30
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %21
34: ; preds = %21
%35 = load i8*, i8** %7
%36 = call i64 @unlink(i8* %35)
%37 = icmp sgt i64 0, %36
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = load i32, i32* @EXIT_FAILURE
store i32 %39, i32* %3
br label %42
40: ; preds = %34
%41 = load i32, i32* @EXIT_SUCCESS
store i32 %41, i32* %3
br label %42
42: ; preds = %40, %38, %28, %11
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %20, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
br label %12
9: ; preds = %12
%10 = add nuw nsw i32 %13, 1
%11 = icmp eq i32 %10, 64
br i1 %11, label %16, label %12
12: ; preds = %4, %9
%13 = phi i32 [ 0, %4 ], [ %10, %9 ]
%14 = tail call i64 @chdir(i8* %6)
%15 = icmp slt i64 %14, 0
br i1 %15, label %20, label %9
16: ; preds = %9
%17 = tail call i64 @unlink(i8* %8)
%18 = icmp slt i64 %17, 0
%19 = select i1 %18, i32* @EXIT_FAILURE, i32* @EXIT_SUCCESS
br label %20
20: ; preds = %12, %16, %2
%21 = phi i32* [ @EXIT_FAILURE, %2 ], [ %19, %16 ], [ @EXIT_FAILURE, %12 ]
%22 = load i32, i32* %21
ret i32 %22
}