#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*/ sleep(int);
int unlink(char *);
int util_really_remove_file(char *path) {
  int deleted = 0;
  deleted = unlink(path);
  if (deleted < 0) {
    sleep(2);
    deleted = unlink(path);
    if (deleted < 0) {
      sleep(3);
      deleted = unlink(path);
      if (deleted < 0) {
        return -1;
      }
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<util_really_remove_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <unlink@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    119f <util_really_remove_file+0x7f>
mov    $0x2,%edi
call   1040 <sleep@plt>
mov    -0x10(%rbp),%rdi
call   1030 <unlink@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    119a <util_really_remove_file+0x7a>
mov    $0x3,%edi
call   1040 <sleep@plt>
mov    -0x10(%rbp),%rdi
call   1030 <unlink@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1195 <util_really_remove_file+0x75>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a6 <util_really_remove_file+0x86>
jmp    119a <util_really_remove_file+0x7a>
jmp    119f <util_really_remove_file+0x7f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_really_remove_file>:
push   %rbx
mov    %rdi,%rbx
call   1030 <unlink@plt>
test   %eax,%eax
jns    1159 <util_really_remove_file+0x39>
mov    $0x2,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
test   %eax,%eax
jns    1159 <util_really_remove_file+0x39>
mov    $0x3,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
test   %eax,%eax
js     1160 <util_really_remove_file+0x40>
mov    $0x1,%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @util_really_remove_file(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @unlink(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %1
%10 = call i32 @sleep(i32 2)
%11 = load i8*, i8** %3
%12 = call i32 @unlink(i8* %11)
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %9
%16 = call i32 @sleep(i32 3)
%17 = load i8*, i8** %3
%18 = call i32 @unlink(i8* %17)
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %15
store i32 -1, i32* %2
br label %25
22: ; preds = %15
br label %23
23: ; preds = %22, %9
br label %24
24: ; preds = %23, %1
store i32 1, i32* %2
br label %25
25: ; preds = %24, %21
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @util_really_remove_file(i8* nocapture %0) {
%2 = tail call i32 @unlink(i8* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = tail call i32 @sleep(i32 2)
%6 = tail call i32 @unlink(i8* %0)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = tail call i32 @sleep(i32 3)
%10 = tail call i32 @unlink(i8* %0)
%11 = icmp slt i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %4, %8, %1
br label %13
13: ; preds = %8, %12
%14 = phi i32 [ 1, %12 ], [ -1, %8 ]
ret i32 %14
}