#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 130
#define ELOOP 129
#define ENODEV 128
int br_add_interface(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int);
int br_cmd_addif(char **argv) {
  int err;
  switch (err = br_add_interface(argv[1], argv[2])) {
  case 0:
    return 0;
  case ENODEV:
    fprintf(stderr, "interface %s does not exist!\n", argv[2]);
    return 1;
  case EBUSY:
    fprintf(stderr,
            "device %s is already a member of a bridge; "
            "can't enslave it to bridge %s.\n",
            argv[2], argv[1]);
    return 1;
  case ELOOP:
    fprintf(stderr,
            "device %s is a bridge device itself; "
            "can't enslave a bridge device to a bridge device.\n",
            argv[2]);
    return 1;
  default:
    fprintf(stderr, "can't add %s to bridge %s: %s\n", argv[2], argv[1],
            strerror(err));
    return 1;
  }
}


x86 assembly (clang, -O0):
<br_cmd_addif>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x10(%rax),%rsi
call   1030 <br_add_interface@plt>
mov    %eax,-0x14(%rbp)
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
test   %eax,%eax
je     119b <br_cmd_addif+0x6b>
jmp    1162 <br_cmd_addif+0x32>
mov    -0x18(%rbp),%eax
sub    $0x80,%eax
je     11a7 <br_cmd_addif+0x77>
jmp    1175 <br_cmd_addif+0x45>
mov    -0x18(%rbp),%eax
sub    $0x81,%eax
je     1205 <br_cmd_addif+0xd5>
jmp    1188 <br_cmd_addif+0x58>
mov    -0x18(%rbp),%eax
sub    $0x82,%eax
je     11d2 <br_cmd_addif+0xa2>
jmp    1230 <br_cmd_addif+0x100>
movl   $0x0,-0x4(%rbp)
jmp    127f <br_cmd_addif+0x14f>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe41(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    127f <br_cmd_addif+0x14f>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xe2c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    127f <br_cmd_addif+0x14f>
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe4c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    127f <br_cmd_addif+0x14f>
mov    0x2da9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <strerror@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    %rax,%r8
lea    0xe50(%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_addif>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x8(%rdi),%rdi
mov    0x10(%rbx),%rsi
call   1030 <br_add_interface@plt>
cmp    $0x80,%eax
jg     1170 <br_cmd_addif+0x40>
test   %eax,%eax
je     11f2 <br_cmd_addif+0xc2>
cmp    $0x80,%eax
jne    119f <br_cmd_addif+0x6f>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rdx
lea    0xe92(%rip),%rsi
jmp    11e6 <br_cmd_addif+0xb6>
cmp    $0x81,%eax
je     11d2 <br_cmd_addif+0xa2>
cmp    $0x82,%eax
jne    119f <br_cmd_addif+0x6f>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rcx
mov    0x10(%rbx),%rdx
lea    0xe88(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11ed <br_cmd_addif+0xbd>
mov    0x2e3a(%rip),%rcx
mov    (%rcx),%ebp
mov    0x8(%rbx),%r14
mov    0x10(%rbx),%rbx
mov    %eax,%edi
call   1050 <strerror@plt>
lea    0xf03(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11ed <br_cmd_addif+0xbd>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rdx
lea    0xe83(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"interface %s does not exist!\0A\00"
@.str.1 = [75 x i8] c"device %s is already a member of a bridge; can't enslave it to bridge %s.\0A\00"
@.str.2 = [88 x i8] c"device %s is a bridge device itself; can't enslave a bridge device to a bridge device.\0A\00"
@.str.3 = [31 x i8] c"can't add %s to bridge %s: %s\0A\00"
define i32 @br_cmd_addif(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 = load i8**, i8*** %3
%9 = getelementptr inbounds i8*, i8** %8, i64 2
%10 = load i8*, i8** %9
%11 = call i32 @br_add_interface(i8* %7, i8* %10)
store i32 %11, i32* %4
switch i32 %11, label %34 [
i32 0, label %12
i32 128, label %13
i32 130, label %19
i32 129, label %28
]
12: ; preds = %1
store i32 0, i32* %2
br label %45
13: ; preds = %1
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %3
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %17)
store i32 1, i32* %2
br label %45
19: ; preds = %1
%20 = load i32, i32* @stderr
%21 = load i8**, i8*** %3
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %3
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0), i8* %23, i8* %26)
store i32 1, i32* %2
br label %45
28: ; preds = %1
%29 = load i32, i32* @stderr
%30 = load i8**, i8*** %3
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.2, i64 0, i64 0), i8* %32)
store i32 1, i32* %2
br label %45
34: ; preds = %1
%35 = load i32, i32* @stderr
%36 = load i8**, i8*** %3
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = load i8**, i8*** %3
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = load i32, i32* %4
%43 = call i8* @strerror(i32 %42)
%44 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %38, i8* %41, i8* %43)
store i32 1, i32* %2
br label %45
45: ; preds = %34, %28, %19, %13, %12
%46 = load i32, i32* %2
ret i32 %46
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"interface %s does not exist!\0A\00"
@.str.1 = [75 x i8] c"device %s is already a member of a bridge; can't enslave it to bridge %s.\0A\00"
@.str.2 = [88 x i8] c"device %s is a bridge device itself; can't enslave a bridge device to a bridge device.\0A\00"
@.str.3 = [31 x i8] c"can't add %s to bridge %s: %s\0A\00"
define i32 @br_cmd_addif(i8** nocapture %0) {
%2 = getelementptr inbounds i8*, i8** %0, i64 1
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8*, i8** %0, i64 2
%5 = load i8*, i8** %4
%6 = tail call i32 @br_add_interface(i8* %3, i8* %5)
switch i32 %6, label %20 [
i32 0, label %26
i32 128, label %7
i32 130, label %11
i32 129, label %16
]
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %4
%10 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %26
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %4
%14 = load i8*, i8** %2
%15 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %14)
br label %26
16: ; preds = %1
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %4
%19 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %26
20: ; preds = %1
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %4
%23 = load i8*, i8** %2
%24 = tail call i8* @strerror(i32 %6)
%25 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %22, i8* %23, i8* %24)
br label %26
26: ; preds = %1, %20, %16, %11, %7
%27 = phi i32 [ 1, %20 ], [ 1, %16 ], [ 1, %11 ], [ 1, %7 ], [ %6, %1 ]
ret i32 %27
}