#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 EINVAL 129
#define ENODEV 128
int br_del_interface(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int);
int br_cmd_delif(char **argv) {
  int err;
  switch (err = br_del_interface(argv[1], argv[2])) {
  case 0:
    return 0;
  case ENODEV:
    fprintf(stderr, "interface %s does not exist!\n", argv[2]);
    return 1;
  case EINVAL:
    fprintf(stderr, "device %s is not a slave of %s\n", argv[2], argv[1]);
    return 1;
  default:
    fprintf(stderr, "can't delete %s from %s: %s\n", argv[2], argv[1],
            strerror(err));
    return 1;
  }
}


x86 assembly (clang, -O0):
<br_cmd_delif>:
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   1040 <br_del_interface@plt>
mov    %eax,-0x14(%rbp)
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
test   %eax,%eax
je     1188 <br_cmd_delif+0x58>
jmp    1162 <br_cmd_delif+0x32>
mov    -0x18(%rbp),%eax
sub    $0x80,%eax
je     1194 <br_cmd_delif+0x64>
jmp    1175 <br_cmd_delif+0x45>
mov    -0x18(%rbp),%eax
sub    $0x81,%eax
je     11bf <br_cmd_delif+0x8f>
jmp    11f2 <br_cmd_delif+0xc2>
movl   $0x0,-0x4(%rbp)
jmp    1241 <br_cmd_delif+0x111>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe54(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1241 <br_cmd_delif+0x111>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xe3f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1241 <br_cmd_delif+0x111>
mov    0x2de7(%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    0xe0b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<br_cmd_delif>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x8(%rdi),%rdi
mov    0x10(%rbx),%rsi
call   1040 <br_del_interface@plt>
test   %eax,%eax
je     11ce <br_cmd_delif+0x9e>
cmp    $0x81,%eax
je     1177 <br_cmd_delif+0x47>
cmp    $0x80,%eax
jne    1198 <br_cmd_delif+0x68>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rdx
lea    0xe92(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11c9 <br_cmd_delif+0x99>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rcx
mov    0x10(%rbx),%rdx
lea    0xe8f(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11c9 <br_cmd_delif+0x99>
mov    0x2e41(%rip),%rcx
mov    (%rcx),%ebp
mov    0x8(%rbx),%r14
mov    0x10(%rbx),%rbx
mov    %eax,%edi
call   1050 <strerror@plt>
lea    0xe87(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1030 <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 = [32 x i8] c"device %s is not a slave of %s\0A\00"
@.str.2 = [29 x i8] c"can't delete %s from %s: %s\0A\00"
define i32 @br_cmd_delif(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_del_interface(i8* %7, i8* %10)
store i32 %11, i32* %4
switch i32 %11, label %28 [
i32 0, label %12
i32 128, label %13
i32 129, label %19
]
12: ; preds = %1
store i32 0, i32* %2
br label %39
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 %39
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 ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %23, i8* %26)
store i32 1, i32* %2
br label %39
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 = load i8**, i8*** %3
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = load i32, i32* %4
%37 = call i8* @strerror(i32 %36)
%38 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %32, i8* %35, i8* %37)
store i32 1, i32* %2
br label %39
39: ; preds = %28, %19, %13, %12
%40 = load i32, i32* %2
ret i32 %40
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"interface %s does not exist!\0A\00"
@.str.1 = [32 x i8] c"device %s is not a slave of %s\0A\00"
@.str.2 = [29 x i8] c"can't delete %s from %s: %s\0A\00"
define i32 @br_cmd_delif(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_del_interface(i8* %3, i8* %5)
switch i32 %6, label %16 [
i32 0, label %22
i32 128, label %7
i32 129, label %11
]
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 %22
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 ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %14)
br label %22
16: ; preds = %1
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %4
%19 = load i8*, i8** %2
%20 = tail call i8* @strerror(i32 %6)
%21 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %18, i8* %19, i8* %20)
br label %22
22: ; preds = %1, %16, %11, %7
%23 = phi i32 [ 1, %16 ], [ 1, %11 ], [ 1, %7 ], [ %6, %1 ]
ret i32 %23
}