#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 *const);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *const, ...);
int /*<<< orphan*/ stderr;
char *strerror(int);
int br_cmd_delbr(int argc, char *const *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    %edi,-0x8(%rbp)
mov    %rsi,-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     1187 <br_cmd_delbr+0x57>
jmp    1161 <br_cmd_delbr+0x31>
mov    -0x18(%rbp),%eax
sub    $0x80,%eax
je     1193 <br_cmd_delbr+0x63>
jmp    1174 <br_cmd_delbr+0x44>
mov    -0x18(%rbp),%eax
sub    $0x81,%eax
je     11be <br_cmd_delbr+0x8e>
jmp    11e9 <br_cmd_delbr+0xb9>
movl   $0x0,-0x4(%rbp)
jmp    1228 <br_cmd_delbr+0xf8>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1228 <br_cmd_delbr+0xf8>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe54(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1228 <br_cmd_delbr+0xf8>
mov    0x2df0(%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    0xe38(%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    %rsi,%rbx
mov    0x8(%rsi),%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(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @br_del_bridge(i8* %9)
store i32 %10, i32* %6
switch i32 %10, label %24 [
i32 0, label %11
i32 128, label %12
i32 129, label %18
]
11: ; preds = %2
store i32 0, i32* %3
br label %32
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 1, i32* %3
br label %32
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %22)
store i32 1, i32* %3
br label %32
24: ; preds = %2
%25 = load i32, i32* @stderr
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = load i32, i32* %6
%30 = call i8* @strerror(i32 %29)
%31 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %28, i8* %30)
store i32 1, i32* %3
br label %32
32: ; preds = %24, %18, %12, %11
%33 = load i32, i32* %3
ret i32 %33
}

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(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @br_del_bridge(i8* %4)
switch i32 %5, label %14 [
i32 0, label %19
i32 128, label %6
i32 129, label %10
]
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %3
%9 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %19
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %3
%13 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %19
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %3
%17 = tail call i8* @strerror(i32 %5)
%18 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %16, i8* %17)
br label %19
19: ; preds = %2, %14, %10, %6
%20 = phi i32 [ 1, %14 ], [ 1, %10 ], [ 1, %6 ], [ %5, %2 ]
ret i32 %20
}