#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*/ perror(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char const *);
scalar_t__ unlink(char *);
int removedb(const char *iface, const char *dirname) {
  char file[512];
  snprintf(file, 512, "%s/.%s", dirname, iface);
  unlink(file);
  snprintf(file, 512, "%s/%s", dirname, iface);
  if (unlink(file) != 0) {
    perror("unlink");
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<removedb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    $0x200,%esi
lea    0xea2(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x220(%rbp),%rdi
call   1030 <unlink@plt>
lea    -0x220(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    $0x200,%esi
lea    0xe7d(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x220(%rbp),%rdi
call   1030 <unlink@plt>
cmp    $0x0,%rax
je     11bd <removedb+0x8d>
lea    0xe61(%rip),%rdi
call   1050 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c4 <removedb+0x94>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removedb>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xeb7(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x200,%esi
mov    %rbx,%rcx
mov    %r14,%r8
call   1040 <snprintf@plt>
mov    %r15,%rdi
call   1030 <unlink@plt>
lea    0xe99(%rip),%rdx
mov    %r15,%rdi
mov    $0x200,%esi
mov    %rbx,%rcx
mov    %r14,%r8
call   1040 <snprintf@plt>
mov    %r15,%rdi
call   1030 <unlink@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    11a3 <removedb+0x73>
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe63(%rip),%rdi
call   1050 <perror@plt>
xor    %eax,%eax
jmp    1196 <removedb+0x66>

LLVM IR (-O0):
@.str = [7 x i8] c"%s/.%s\00"
@.str.1 = [6 x i8] c"%s/%s\00"
@.str.2 = [7 x i8] c"unlink\00"
define i32 @removedb(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [512 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%8 = load i8*, i8** %5
%9 = load i8*, i8** %4
%10 = call i32 @snprintf(i8* %7, i32 512, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%12 = call i64 @unlink(i8* %11)
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%14 = load i8*, i8** %5
%15 = load i8*, i8** %4
%16 = call i32 @snprintf(i8* %13, i32 512, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %14, i8* %15)
%17 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%18 = call i64 @unlink(i8* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %23
22: ; preds = %2
store i32 1, i32* %3
br label %23
23: ; preds = %22, %20
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s/.%s\00"
@.str.1 = [6 x i8] c"%s/%s\00"
@.str.2 = [7 x i8] c"unlink\00"
define i32 @removedb(i8* %0, i8* %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 512, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
%6 = call i64 @unlink(i8* %4)
%7 = call i32 @snprintf(i8* %4, i32 512, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %0)
%8 = call i64 @unlink(i8* %4)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %2, %10
%13 = phi i32 [ 0, %10 ], [ 1, %2 ]
ret i32 %13
}