#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 */
scalar_t__ ENOSYS;
int /*<<< orphan*/ complain(char *, char const *);
scalar_t__ errno;
scalar_t__ remove(char const *);
void doremove(const char *path) {
  static int noremove;
  if (noremove) {
    return;
  }
  if (remove(path) < 0) {
    if (errno == ENOSYS) {
      noremove = 1;
    }
    complain("%s: remove", path);
  }
}


x86 assembly (clang, -O0):
<doremove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpl   $0x0,0x2f05(%rip)
je     113e <doremove+0x1e>
jmp    1185 <doremove+0x65>
mov    -0x8(%rbp),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
jge    1185 <doremove+0x65>
mov    0x2e80(%rip),%rax
mov    (%rax),%rax
mov    0x2e86(%rip),%rcx
cmp    (%rcx),%rax
jne    1175 <doremove+0x55>
movl   $0x1,0x2ec3(%rip)
mov    -0x8(%rbp),%rsi
lea    0xe80(%rip),%rdi
call   1040 <complain@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doremove>:
push   %rbx
cmpb   $0x0,0x2f10(%rip)
jne    1137 <doremove+0x17>
mov    %rdi,%rbx
call   1030 <remove@plt>
test   %rax,%rax
js     1139 <doremove+0x19>
pop    %rbx
ret
mov    0x2e98(%rip),%rax
mov    (%rax),%rax
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%rax
jne    1156 <doremove+0x36>
movb   $0x1,0x2ee2(%rip)
lea    0xea3(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <complain@plt>

LLVM IR (-O0):
@doremove.noremove = internal global i32 0
@errno = global i64 0
@ENOSYS = global i64 0
@.str = [11 x i8] c"%s: remove\00"
define void @doremove(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @doremove.noremove
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %18
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i64 @remove(i8* %7)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i64, i64* @errno
%12 = load i64, i64* @ENOSYS
%13 = icmp eq i64 %11, %12
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* @doremove.noremove
br label %15
15: ; preds = %14, %10
%16 = load i8*, i8** %2
%17 = call i32 @complain(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %5, %15, %6
ret void
}

LLVM IR (-O2):
@doremove.noremove = internal unnamed_addr global i1 false
@errno = global i64 0
@ENOSYS = global i64 0
@.str = [11 x i8] c"%s: remove\00"
define void @doremove(i8* %0) {
%2 = load i1, i1* @doremove.noremove
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = tail call i64 @remove(i8* %0)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i64, i64* @errno
%8 = load i64, i64* @ENOSYS
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %6
store i1 true, i1* @doremove.noremove
br label %11
11: ; preds = %10, %6
%12 = tail call i32 @complain(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %13
13: ; preds = %1, %11, %3
ret void
}