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


x86 assembly (clang, -O0):
<br_cmd_delif>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    1268 <br_cmd_delif+0x138>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <br_del_interface@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
test   %eax,%eax
je     11d3 <br_cmd_delif+0xa3>
jmp    11ad <br_cmd_delif+0x7d>
mov    -0x2c(%rbp),%eax
sub    $0x80,%eax
je     11d8 <br_cmd_delif+0xa8>
jmp    11c0 <br_cmd_delif+0x90>
mov    -0x2c(%rbp),%eax
sub    $0x81,%eax
je     11f8 <br_cmd_delif+0xc8>
jmp    121c <br_cmd_delif+0xec>
jmp    115f <br_cmd_delif+0x2f>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xe14(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    125c <br_cmd_delif+0x12c>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    125c <br_cmd_delif+0x12c>
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x1c(%rbp),%edi
call   1050 <strerror@plt>
mov    -0x44(%rbp),%edi
mov    -0x40(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    %rax,%r8
lea    0xde9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    126f <br_cmd_delif+0x13f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<br_cmd_delif>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
add    $0xfffffffe,%ebp
mov    0x8(%rsi),%r14
add    $0x10,%rbx
nopw   0x0(%rax,%rax,1)
test   %ebp,%ebp
jle    1197 <br_cmd_delif+0x67>
add    $0xffffffff,%ebp
mov    (%rbx),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <br_del_interface@plt>
add    $0x8,%rbx
test   %eax,%eax
je     1150 <br_cmd_delif+0x20>
cmp    $0x81,%eax
je     119b <br_cmd_delif+0x6b>
cmp    $0x80,%eax
jne    11ba <br_cmd_delif+0x8a>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
lea    0xe75(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11e3 <br_cmd_delif+0xb3>
xor    %eax,%eax
jmp    11e8 <br_cmd_delif+0xb8>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
lea    0xe73(%rip),%rsi
mov    %r15,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11e3 <br_cmd_delif+0xb3>
mov    0x2e1f(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1050 <strerror@plt>
lea    0xe6d(%rip),%rsi
mov    %ebx,%edi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
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(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 2
store i32 %10, i32* %4
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i32 1
store i8** %12, i8*** %5
%13 = load i8*, i8** %12
store i8* %13, i8** %6
br label %14
14: ; preds = %26, %2
%15 = load i32, i32* %4
%16 = add nsw i32 %15, -1
store i32 %16, i32* %4
%17 = icmp sgt i32 %15, 0
br i1 %17, label %18, label %44
18: ; preds = %14
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i32 1
store i8** %20, i8*** %5
%21 = load i8*, i8** %20
store i8* %21, i8** %8
%22 = load i8*, i8** %6
%23 = load i8*, i8** %8
%24 = call i32 @br_del_interface(i8* %22, i8* %23)
store i32 %24, i32* %7
%25 = load i32, i32* %7
switch i32 %25, label %36 [
i32 0, label %26
i32 128, label %27
i32 129, label %31
]
26: ; preds = %18
br label %14
27: ; preds = %18
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %8
%30 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %29)
br label %43
31: ; preds = %18
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %8
%34 = load i8*, i8** %6
%35 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %33, i8* %34)
br label %43
36: ; preds = %18
%37 = load i32, i32* @stderr
%38 = load i8*, i8** %8
%39 = load i8*, i8** %6
%40 = load i32, i32* %7
%41 = call i8* @strerror(i32 %40)
%42 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %38, i8* %39, i8* %41)
br label %43
43: ; preds = %36, %31, %27
store i32 1, i32* %3
br label %45
44: ; preds = %14
store i32 0, i32* %3
br label %45
45: ; preds = %44, %43
%46 = load i32, i32* %3
ret i32 %46
}

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(i32 %0, i8** nocapture %1) {
%3 = add nsw i32 %0, -2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
br label %6
6: ; preds = %10, %2
%7 = phi i8** [ %4, %2 ], [ %12, %10 ]
%8 = phi i32 [ %3, %2 ], [ %11, %10 ]
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %25
10: ; preds = %6
%11 = add nsw i32 %8, -1
%12 = getelementptr inbounds i8*, i8** %7, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @br_del_interface(i8* %5, i8* %13)
switch i32 %14, label %21 [
i32 0, label %6
i32 128, label %15
i32 129, label %18
]
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %25
18: ; preds = %10
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %5)
br label %25
21: ; preds = %10
%22 = load i32, i32* @stderr
%23 = tail call i8* @strerror(i32 %14)
%24 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %13, i8* %5, i8* %23)
br label %25
25: ; preds = %6, %21, %18, %15
%26 = phi i32 [ 1, %15 ], [ 1, %18 ], [ 1, %21 ], [ 0, %6 ]
ret i32 %26
}