#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 */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ execl(char *, char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ wait(int *);
void cleanup(char name[]) {
  char tmp_name[256];
  pid_t child;
  int status;
  if ((child = fork()) == 0) {
    snprintf(tmp_name, 256, "rm -f %s-PREMAP*", name);
    execl("/bin/sh", "/bin/sh", "-c", tmp_name, NULL);
    exit(1);
  }
  wait(&status);
}


x86 assembly (clang, -O0):
<cleanup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1070 <fork@plt>
mov    %eax,-0x114(%rbp)
cmp    $0x0,%eax
jne    11bd <cleanup+0x6d>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x100,%esi
lea    0xe74(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x110(%rbp),%rcx
lea    0xe72(%rip),%rsi
lea    0xe73(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
call   1050 <execl@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
lea    -0x118(%rbp),%rdi
call   1060 <wait@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%rbx
xor    %eax,%eax
call   1070 <fork@plt>
test   %eax,%eax
je     117b <cleanup+0x2b>
mov    %rsp,%rdi
call   1060 <wait@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe7e(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rbx,%rcx
call   1030 <snprintf@plt>
lea    0xe75(%rip),%rdi
lea    0xe76(%rip),%rdx
mov    %rdi,%rsi
mov    %r14,%rcx
xor    %r8d,%r8d
call   1050 <execl@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"rm -f %s-PREMAP*\00"
@.str.1 = [8 x i8] c"/bin/sh\00"
@.str.2 = [3 x i8] c"-c\00"
define void @cleanup(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
%6 = call i32 (...) @fork()
store i32 %6, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %1
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%10 = load i8*, i8** %2
%11 = call i32 @snprintf(i8* %9, i32 256, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%13 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %12, i32* null)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %1
%16 = call i32 @wait(i32* %5)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"rm -f %s-PREMAP*\00"
@.str.1 = [8 x i8] c"/bin/sh\00"
@.str.2 = [3 x i8] c"-c\00"
define void @cleanup(i8* %0) {
%2 = alloca [256 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = bitcast i32* %3 to i8*
%6 = tail call i32 (...) @fork()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = call i32 @snprintf(i8* %4, i32 256, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
%10 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %4, i32* null)
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = call i32 @wait(i32* %3)
ret void
}