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


x86 assembly (clang, -O0):
<ifc_clear_ipv4_addresses>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <ifc_init@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     117d <ifc_clear_ipv4_addresses+0x3d>
cmpl   $0xff,-0xc(%rbp)
setb   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    118d <ifc_clear_ipv4_addresses+0x4d>
jmp    11d1 <ifc_clear_ipv4_addresses+0x91>
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <ifc_get_addr@plt>
cmp    $0x0,%rax
jge    11a9 <ifc_clear_ipv4_addresses+0x69>
jmp    11d1 <ifc_clear_ipv4_addresses+0x91>
cmpl   $0x0,-0x10(%rbp)
je     11be <ifc_clear_ipv4_addresses+0x7e>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <ifc_set_addr@plt>
jmp    11c3 <ifc_clear_ipv4_addresses+0x83>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1161 <ifc_clear_ipv4_addresses+0x21>
mov    $0x0,%al
call   1060 <ifc_close@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifc_clear_ipv4_addresses>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r15
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <ifc_init@plt>
movl   $0x1,0xc(%rsp)
lea    0xc(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <ifc_get_addr@plt>
test   %rax,%rax
js     11a5 <ifc_clear_ipv4_addresses+0x65>
cmpl   $0x0,0xc(%rsp)
je     11a5 <ifc_clear_ipv4_addresses+0x65>
mov    %r15,%rdi
xor    %esi,%esi
call   1030 <ifc_set_addr@plt>
cmpl   $0x0,0xc(%rsp)
je     11a5 <ifc_clear_ipv4_addresses+0x65>
lea    0x1(%rbx),%eax
cmp    $0xfe,%ebx
mov    %eax,%ebx
jb     1170 <ifc_clear_ipv4_addresses+0x30>
xor    %eax,%eax
call   1060 <ifc_close@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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