#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*/ 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) {
    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    0xeb2(%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    0xe8d(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x220(%rbp),%rdi
call   1030 <unlink@plt>
cmp    $0x0,%rax
je     11a1 <removedb+0x81>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <removedb+0x88>
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    0xec7(%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    0xea9(%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>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s/.%s\00"
@.str.1 = [6 x i8] c"%s/%s\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 %21
20: ; preds = %2
store i32 0, i32* %3
br label %22
21: ; preds = %2
store i32 1, i32* %3
br label %22
22: ; preds = %21, %20
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s/.%s\00"
@.str.1 = [6 x i8] c"%s/%s\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
%10 = zext i1 %9 to i32
ret i32 %10
}