#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 */
int /*<<< orphan*/ ifc_close();
int ifc_down(char const *);
scalar_t__ ifc_get_addr(char const *, unsigned int *);
int /*<<< orphan*/ ifc_init();
int /*<<< orphan*/ ifc_set_addr(char const *, int /*<<< orphan*/);
int ifc_disable(const char *ifname) {
  unsigned addr, count;
  int result;
  ifc_init();
  result = ifc_down(ifname);
  ifc_set_addr(ifname, 0);
  for (count = 0, addr = 1; ((addr != 0) && (count < 255)); count++) {
    if (ifc_get_addr(ifname, &addr) < 0)
      break;
    if (addr)
      ifc_set_addr(ifname, 0);
  }
  ifc_close();
  return result;
}


x86 assembly (clang, -O0):
<ifc_disable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <ifc_init@plt>
mov    -0x8(%rbp),%rdi
call   1060 <ifc_down@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <ifc_set_addr@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x15(%rbp)
je     11a4 <ifc_disable+0x54>
cmpl   $0xff,-0x10(%rbp)
setb   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    11b4 <ifc_disable+0x64>
jmp    11f8 <ifc_disable+0xa8>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <ifc_get_addr@plt>
cmp    $0x0,%rax
jge    11d0 <ifc_disable+0x80>
jmp    11f8 <ifc_disable+0xa8>
cmpl   $0x0,-0xc(%rbp)
je     11e5 <ifc_disable+0x95>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <ifc_set_addr@plt>
jmp    11ea <ifc_disable+0x9a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1188 <ifc_disable+0x38>
mov    $0x0,%al
call   1070 <ifc_close@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifc_disable>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <ifc_init@plt>
mov    %rbx,%rdi
call   1060 <ifc_down@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <ifc_set_addr@plt>
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <ifc_get_addr@plt>
test   %rax,%rax
js     11c5 <ifc_disable+0x75>
cmpl   $0x0,0x4(%rsp)
je     11c5 <ifc_disable+0x75>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <ifc_set_addr@plt>
cmpl   $0x0,0x4(%rsp)
je     11c5 <ifc_disable+0x75>
lea    0x1(%rbp),%eax
cmp    $0xfe,%ebp
mov    %eax,%ebp
jb     1190 <ifc_disable+0x40>
xor    %eax,%eax
call   1070 <ifc_close@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ifc_disable(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
%6 = call i32 (...) @ifc_init()
%7 = load i8*, i8** %2
%8 = call i32 @ifc_down(i8* %7)
store i32 %8, i32* %5
%9 = load i8*, i8** %2
%10 = call i32 @ifc_set_addr(i8* %9, i32 0)
store i32 0, i32* %4
store i32 1, i32* %3
br label %11
11: ; preds = %31, %1
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32, i32* %4
%16 = icmp ult i32 %15, 255
br label %17
17: ; preds = %14, %11
%18 = phi i1 [ false, %11 ], [ %16, %14 ]
br i1 %18, label %19, label %34
19: ; preds = %17
%20 = load i8*, i8** %2
%21 = call i64 @ifc_get_addr(i8* %20, i32* %3)
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %19
br label %34
24: ; preds = %19
%25 = load i32, i32* %3
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i8*, i8** %2
%29 = call i32 @ifc_set_addr(i8* %28, i32 0)
br label %30
30: ; preds = %27, %24
br label %31
31: ; preds = %30
%32 = load i32, i32* %4
%33 = add i32 %32, 1
store i32 %33, i32* %4
br label %11
34: ; preds = %23, %17
%35 = call i32 (...) @ifc_close()
%36 = load i32, i32* %5
ret i32 %36
}

LLVM IR (-O2):
define i32 @ifc_disable(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 (...) @ifc_init()
%5 = tail call i32 @ifc_down(i8* %0)
%6 = tail call i32 @ifc_set_addr(i8* %0, i32 0)
store i32 1, i32* %2
br label %7
7: ; preds = %1, %14
%8 = phi i32 [ %17, %14 ], [ 0, %1 ]
%9 = call i64 @ifc_get_addr(i8* %0, i32* %2)
%10 = icmp slt i64 %9, 0
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 0
%13 = select i1 %10, i1 true, i1 %12
br i1 %13, label %21, label %14
14: ; preds = %7
%15 = call i32 @ifc_set_addr(i8* %0, i32 0)
%16 = load i32, i32* %2
%17 = add nuw nsw i32 %8, 1
%18 = icmp ne i32 %16, 0
%19 = icmp ult i32 %8, 254
%20 = select i1 %18, i1 %19, i1 false
br i1 %20, label %7, label %21
21: ; preds = %14, %7
%22 = call i32 (...) @ifc_close()
ret i32 %5
}