#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*/ fp;

/* Variables and functions */
#define ENOENT 128
int errno;
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int JFDB_wipe(const char *path) {
  int failed = 0;
  char fp[1024 + 6];
  snprintf(fp, sizeof(fp), "%s.keys", path);
  remove(fp);
  switch (errno) {
  case 0:
  case ENOENT:
    break;
  default:
    failed |= 0b01;
    break;
  }
  snprintf(fp, sizeof(fp), "%s.vals", path);
  remove(fp);
  switch (errno) {
  case 0:
  case ENOENT:
    break;
  default:
    failed |= 0b10;
    break;
  }
  return failed;
}


x86 assembly (clang, -O0):
<JFDB_wipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
lea    0xebf(%rip),%rdx
lea    -0x420(%rbp),%rdi
mov    %rdi,-0x428(%rbp)
mov    $0x406,%esi
call   1040 <snprintf@plt>
mov    -0x428(%rbp),%rdi
call   1030 <remove@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%eax
test   $0xffffff7f,%eax
je     117e <JFDB_wipe+0x5e>
jmp    1183 <JFDB_wipe+0x63>
jmp    118c <JFDB_wipe+0x6c>
mov    -0xc(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
lea    0xe71(%rip),%rdx
lea    -0x420(%rbp),%rdi
mov    %rdi,-0x430(%rbp)
mov    $0x406,%esi
call   1040 <snprintf@plt>
mov    -0x430(%rbp),%rdi
call   1030 <remove@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%eax
test   $0xffffff7f,%eax
je     11d4 <JFDB_wipe+0xb4>
jmp    11d9 <JFDB_wipe+0xb9>
jmp    11e2 <JFDB_wipe+0xc2>
mov    -0xc(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<JFDB_wipe>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%r14
lea    0xec8(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x406,%esi
mov    %r14,%rcx
call   1040 <snprintf@plt>
mov    %r15,%rdi
call   1030 <remove@plt>
mov    0x2e86(%rip),%r12
xor    %ebx,%ebx
testl  $0xffffff7f,(%r12)
ff
setne  %bl
lea    0xe9a(%rip),%rdx
mov    %r15,%rdi
mov    $0x406,%esi
mov    %r14,%rcx
call   1040 <snprintf@plt>
mov    %r15,%rdi
call   1030 <remove@plt>
testl  $0xffffff7f,(%r12)
ff
je     1193 <JFDB_wipe+0x73>
or     $0x2,%ebx
mov    %ebx,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%s.keys\00"
@errno = global i32 0
@.str.1 = [8 x i8] c"%s.vals\00"
define i32 @JFDB_wipe(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [1030 x i8]
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = getelementptr inbounds [1030 x i8], [1030 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @snprintf(i8* %5, i32 1030, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [1030 x i8], [1030 x i8]* %4, i64 0, i64 0
%9 = call i32 @remove(i8* %8)
%10 = load i32, i32* @errno
switch i32 %10, label %12 [
i32 0, label %11
i32 128, label %11
]
11: ; preds = %1, %1
br label %15
12: ; preds = %1
%13 = load i32, i32* %3
%14 = or i32 %13, 1
store i32 %14, i32* %3
br label %15
15: ; preds = %12, %11
%16 = getelementptr inbounds [1030 x i8], [1030 x i8]* %4, i64 0, i64 0
%17 = load i8*, i8** %2
%18 = call i32 @snprintf(i8* %16, i32 1030, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [1030 x i8], [1030 x i8]* %4, i64 0, i64 0
%20 = call i32 @remove(i8* %19)
%21 = load i32, i32* @errno
switch i32 %21, label %23 [
i32 0, label %22
i32 128, label %22
]
22: ; preds = %15, %15
br label %26
23: ; preds = %15
%24 = load i32, i32* %3
%25 = or i32 %24, 2
store i32 %25, i32* %3
br label %26
26: ; preds = %23, %22
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s.keys\00"
@errno = global i32 0
@.str.1 = [8 x i8] c"%s.vals\00"
define i32 @JFDB_wipe(i8* %0) {
%2 = alloca [1030 x i8]
%3 = getelementptr inbounds [1030 x i8], [1030 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 1030, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 @remove(i8* %3)
%6 = load i32, i32* @errno
%7 = and i32 %6, -129
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @snprintf(i8* %3, i32 1030, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%11 = call i32 @remove(i8* %3)
%12 = load i32, i32* @errno
switch i32 %12, label %13 [
i32 0, label %15
i32 128, label %15
]
13: ; preds = %1
%14 = or i32 %9, 2
br label %15
15: ; preds = %1, %1, %13
%16 = phi i32 [ %14, %13 ], [ %9, %1 ], [ %9, %1 ]
ret i32 %16
}