#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 */
#define EBUSY 129
#define ENXIO 128
int br_del_bridge(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int);
int br_cmd_delbr(char **argv) {
  int err;
  switch (err = br_del_bridge(argv[1])) {
  case 0:
    return 0;
  case ENXIO:
    fprintf(stderr, "bridge %s doesn't exist; can't delete it\n", argv[1]);
    return 1;
  case EBUSY:
    fprintf(stderr, "bridge %s is still up; can't delete it\n", argv[1]);
    return 1;
  default:
    fprintf(stderr, "can't delete bridge %s: %s\n", argv[1], strerror(err));
    return 1;
  }
}


x86 assembly (clang, -O0):
<br_cmd_delbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <br_del_bridge@plt>
mov    %eax,-0x14(%rbp)
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
test   %eax,%eax
je     1184 <br_cmd_delbr+0x54>
jmp    115e <br_cmd_delbr+0x2e>
mov    -0x18(%rbp),%eax
sub    $0x80,%eax
je     1190 <br_cmd_delbr+0x60>
jmp    1171 <br_cmd_delbr+0x41>
mov    -0x18(%rbp),%eax
sub    $0x81,%eax
je     11bb <br_cmd_delbr+0x8b>
jmp    11e6 <br_cmd_delbr+0xb6>
movl   $0x0,-0x4(%rbp)
jmp    1225 <br_cmd_delbr+0xf5>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe58(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1225 <br_cmd_delbr+0xf5>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe57(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1225 <br_cmd_delbr+0xf5>
mov    0x2df3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <strerror@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rdx
mov    %rax,%rcx
lea    0xe3b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<br_cmd_delbr>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x8(%rdi),%rdi
call   1030 <br_del_bridge@plt>
test   %eax,%eax
je     11b3 <br_cmd_delbr+0x83>
cmp    $0x81,%eax
je     1167 <br_cmd_delbr+0x37>
cmp    $0x80,%eax
jne    1184 <br_cmd_delbr+0x54>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xe9b(%rip),%rsi
jmp    117b <br_cmd_delbr+0x4b>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xeaf(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11ae <br_cmd_delbr+0x7e>
mov    0x2e55(%rip),%rcx
mov    (%rcx),%ebp
mov    0x8(%rbx),%rbx
mov    %eax,%edi
call   1050 <strerror@plt>
lea    0xeb3(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [42 x i8] c"bridge %s doesn't exist; can't delete it\0A\00"
@.str.1 = [40 x i8] c"bridge %s is still up; can't delete it\0A\00"
@.str.2 = [28 x i8] c"can't delete bridge %s: %s\0A\00"
define i32 @br_cmd_delbr(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i32
store i8** %0, i8*** %3
%5 = load i8**, i8*** %3
%6 = getelementptr inbounds i8*, i8** %5, i64 1
%7 = load i8*, i8** %6
%8 = call i32 @br_del_bridge(i8* %7)
store i32 %8, i32* %4
switch i32 %8, label %22 [
i32 0, label %9
i32 128, label %10
i32 129, label %16
]
9: ; preds = %1
store i32 0, i32* %2
br label %30
10: ; preds = %1
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %3
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 1, i32* %2
br label %30
16: ; preds = %1
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %3
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %20)
store i32 1, i32* %2
br label %30
22: ; preds = %1
%23 = load i32, i32* @stderr
%24 = load i8**, i8*** %3
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = load i32, i32* %4
%28 = call i8* @strerror(i32 %27)
%29 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %26, i8* %28)
store i32 1, i32* %2
br label %30
30: ; preds = %22, %16, %10, %9
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [42 x i8] c"bridge %s doesn't exist; can't delete it\0A\00"
@.str.1 = [40 x i8] c"bridge %s is still up; can't delete it\0A\00"
@.str.2 = [28 x i8] c"can't delete bridge %s: %s\0A\00"
define i32 @br_cmd_delbr(i8** nocapture %0) {
%2 = getelementptr inbounds i8*, i8** %0, i64 1
%3 = load i8*, i8** %2
%4 = tail call i32 @br_del_bridge(i8* %3)
switch i32 %4, label %13 [
i32 0, label %18
i32 128, label %5
i32 129, label %9
]
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %2
%8 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %18
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %2
%12 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %18
13: ; preds = %1
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %2
%16 = tail call i8* @strerror(i32 %4)
%17 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %15, i8* %16)
br label %18
18: ; preds = %1, %13, %9, %5
%19 = phi i32 [ 1, %13 ], [ 1, %9 ], [ 1, %5 ], [ %4, %1 ]
ret i32 %19
}