#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 */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _remove_keyfiles();
int /*<<< orphan*/ stat(char *, struct stat *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int system(char *);
void _cleanup(void) {
  int r;
  struct stat st;
  if (!stat("/dev/mapper/"
            "ctest1",
            &st))
    r = system("dmsetup remove "
               "ctest1");
  if (!stat("/dev/mapper/"
            "ctest2",
            &st))
    r = system("dmsetup remove "
               "ctest2");
  if (!stat("/dev/mapper/"
            "crypt_zero",
            &st))
    r = system("dmsetup remove "
               "crypt_zero");
  if (!stat("/dev/mapper/"
            "crypt_error",
            &st))
    r = system("dmsetup remove "
               "crypt_error");
  if (!strncmp("/dev/loop", "/dev/loop5", 9))
    r = system("losetup -d "
               "/dev/loop5");
  if (!strncmp("/dev/loop", "/dev/loop6", 9))
    r = system("losetup -d "
               "/dev/loop6");
  r = system("rm -f "
             "empty.img");
  _remove_keyfiles();
}


x86 assembly (clang, -O0):
<_cleanup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <stat@plt>
cmp    $0x0,%eax
jne    1170 <_cleanup+0x30>
lea    0xeab(%rip),%rdi
call   1050 <system@plt>
mov    %eax,-0x4(%rbp)
lea    0xeb2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <stat@plt>
cmp    $0x0,%eax
jne    1198 <_cleanup+0x58>
lea    0xeac(%rip),%rdi
call   1050 <system@plt>
mov    %eax,-0x4(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <stat@plt>
cmp    $0x0,%eax
jne    11c0 <_cleanup+0x80>
lea    0xeb1(%rip),%rdi
call   1050 <system@plt>
mov    %eax,-0x4(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <stat@plt>
cmp    $0x0,%eax
jne    11e8 <_cleanup+0xa8>
lea    0xebb(%rip),%rdi
call   1050 <system@plt>
mov    %eax,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    0xed5(%rip),%rsi
mov    $0x9,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    1218 <_cleanup+0xd8>
lea    0xeb0(%rip),%rdi
call   1050 <system@plt>
mov    %eax,-0x4(%rbp)
lea    0xe97(%rip),%rdi
lea    0xebb(%rip),%rsi
mov    $0x9,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    1248 <_cleanup+0x108>
lea    0xe96(%rip),%rdi
call   1050 <system@plt>
mov    %eax,-0x4(%rbp)
lea    0xe9d(%rip),%rdi
call   1050 <system@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <_remove_keyfiles@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cleanup>:
push   %rax
lea    0xeb8(%rip),%rdi
mov    %rsp,%rsi
call   1060 <stat@plt>
test   %eax,%eax
jne    1160 <_cleanup+0x20>
lea    0xeb8(%rip),%rdi
call   1050 <system@plt>
lea    0xec2(%rip),%rdi
mov    %rsp,%rsi
call   1060 <stat@plt>
test   %eax,%eax
jne    117f <_cleanup+0x3f>
lea    0xec2(%rip),%rdi
call   1050 <system@plt>
lea    0xecc(%rip),%rdi
mov    %rsp,%rsi
call   1060 <stat@plt>
test   %eax,%eax
jne    119e <_cleanup+0x5e>
lea    0xed0(%rip),%rdi
call   1050 <system@plt>
lea    0xede(%rip),%rdi
mov    %rsp,%rsi
call   1060 <stat@plt>
test   %eax,%eax
jne    11bd <_cleanup+0x7d>
lea    0xee3(%rip),%rdi
call   1050 <system@plt>
lea    0xef2(%rip),%rdi
lea    0xf00(%rip),%rsi
mov    $0x9,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
jne    11e5 <_cleanup+0xa5>
lea    0xee0(%rip),%rdi
call   1050 <system@plt>
lea    0xeca(%rip),%rdi
lea    0xeee(%rip),%rsi
mov    $0x9,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
jne    120d <_cleanup+0xcd>
lea    0xece(%rip),%rdi
call   1050 <system@plt>
lea    0xed8(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <_remove_keyfiles@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [19 x i8] c"/dev/mapper/ctest1\00"
@.str.1 = [22 x i8] c"dmsetup remove ctest1\00"
@.str.2 = [19 x i8] c"/dev/mapper/ctest2\00"
@.str.3 = [22 x i8] c"dmsetup remove ctest2\00"
@.str.4 = [23 x i8] c"/dev/mapper/crypt_zero\00"
@.str.5 = [26 x i8] c"dmsetup remove crypt_zero\00"
@.str.6 = [24 x i8] c"/dev/mapper/crypt_error\00"
@.str.7 = [27 x i8] c"dmsetup remove crypt_error\00"
@.str.8 = [10 x i8] c"/dev/loop\00"
@.str.9 = [11 x i8] c"/dev/loop5\00"
@.str.10 = [22 x i8] c"losetup -d /dev/loop5\00"
@.str.11 = [11 x i8] c"/dev/loop6\00"
@.str.12 = [22 x i8] c"losetup -d /dev/loop6\00"
@.str.13 = [16 x i8] c"rm -f empty.img\00"
define void @_cleanup() {
%1 = alloca i32
%2 = alloca %struct.stat
%3 = call i32 @stat(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%4 = icmp ne i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
store i32 %6, i32* %1
br label %7
7: ; preds = %5, %0
%8 = call i32 @stat(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %2)
%9 = icmp ne i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
store i32 %11, i32* %1
br label %12
12: ; preds = %10, %7
%13 = call i32 @stat(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), %struct.stat* %2)
%14 = icmp ne i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = call i32 @system(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
store i32 %16, i32* %1
br label %17
17: ; preds = %15, %12
%18 = call i32 @stat(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), %struct.stat* %2)
%19 = icmp ne i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = call i32 @system(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
store i32 %21, i32* %1
br label %22
22: ; preds = %20, %17
%23 = call i32 @strncmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i32 9)
%24 = icmp ne i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
store i32 %26, i32* %1
br label %27
27: ; preds = %25, %22
%28 = call i32 @strncmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i32 9)
%29 = icmp ne i32 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
store i32 %31, i32* %1
br label %32
32: ; preds = %30, %27
%33 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0))
store i32 %33, i32* %1
%34 = call i32 (...) @_remove_keyfiles()
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [19 x i8] c"/dev/mapper/ctest1\00"
@.str.1 = [22 x i8] c"dmsetup remove ctest1\00"
@.str.2 = [19 x i8] c"/dev/mapper/ctest2\00"
@.str.3 = [22 x i8] c"dmsetup remove ctest2\00"
@.str.4 = [23 x i8] c"/dev/mapper/crypt_zero\00"
@.str.5 = [26 x i8] c"dmsetup remove crypt_zero\00"
@.str.6 = [24 x i8] c"/dev/mapper/crypt_error\00"
@.str.7 = [27 x i8] c"dmsetup remove crypt_error\00"
@.str.8 = [10 x i8] c"/dev/loop\00"
@.str.9 = [11 x i8] c"/dev/loop5\00"
@.str.10 = [22 x i8] c"losetup -d /dev/loop5\00"
@.str.11 = [11 x i8] c"/dev/loop6\00"
@.str.12 = [22 x i8] c"losetup -d /dev/loop6\00"
@.str.13 = [16 x i8] c"rm -f empty.img\00"
define void @_cleanup() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = call i32 @stat(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = call i32 @stat(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %1)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
%13 = call i32 @stat(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), %struct.stat* %1)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = tail call i32 @system(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = call i32 @stat(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), %struct.stat* %1)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @system(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = tail call i32 @strncmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i32 9)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
%28 = tail call i32 @strncmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i32 9)
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = tail call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
%33 = tail call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0))
%34 = tail call i32 (...) @_remove_keyfiles()
ret void
}