#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 init_from_string(char *, int);
int /*<<< orphan*/ log_fatal(char *, char *);
void init_from_array(char **cidrs, size_t len, int value,
                     int ignore_invalid_hosts) {
  for (int i = 0; i < (int)len; i++) {
    int ret = init_from_string(cidrs[i], value);
    if (ret && !ignore_invalid_hosts) {
      log_fatal("constraint", "Unable to init from CIDR list");
    }
  }
}


x86 assembly (clang, -O0):
<init_from_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    %ecx,%eax
jge    119d <init_from_array+0x7d>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x14(%rbp),%esi
call   1030 <init_from_string@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     118a <init_from_array+0x6a>
cmpl   $0x0,-0x18(%rbp)
jne    118a <init_from_array+0x6a>
lea    0xe82(%rip),%rdi
lea    0xe86(%rip),%rsi
call   1040 <log_fatal@plt>
jmp    118f <init_from_array+0x6f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113d <init_from_array+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_from_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    117f <init_from_array+0x5f>
mov    %ecx,%r14d
mov    %edx,%r13d
mov    %rdi,%rbx
mov    %esi,%ebp
xor    %r15d,%r15d
lea    0xec7(%rip),%r12
jmp    1159 <init_from_array+0x39>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r15
cmp    %r15,%rbp
je     117f <init_from_array+0x5f>
mov    (%rbx,%r15,8),%rdi
mov    %r13d,%esi
call   1030 <init_from_string@plt>
test   %r14d,%r14d
jne    1150 <init_from_array+0x30>
test   %eax,%eax
je     1150 <init_from_array+0x30>
lea    0xe8b(%rip),%rdi
mov    %r12,%rsi
call   1040 <log_fatal@plt>
jmp    1150 <init_from_array+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"constraint\00"
@.str.1 = [30 x i8] c"Unable to init from CIDR list\00"
define void @init_from_array(i8** %0, i64 %1, i32 %2, i32 %3) {
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8** %0, i8*** %5
store i64 %1, i64* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %11
11: ; preds = %32, %4
%12 = load i32, i32* %9
%13 = load i64, i64* %6
%14 = trunc i64 %13 to i32
%15 = icmp slt i32 %12, %14
br i1 %15, label %16, label %35
16: ; preds = %11
%17 = load i8**, i8*** %5
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = load i32, i32* %7
%23 = call i32 @init_from_string(i8* %21, i32 %22)
store i32 %23, i32* %10
%24 = load i32, i32* %10
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %16
%27 = load i32, i32* %8
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %26
%30 = call i32 @log_fatal(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %29, %26, %16
br label %32
32: ; preds = %31
%33 = load i32, i32* %9
%34 = add nsw i32 %33, 1
store i32 %34, i32* %9
br label %11
35: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"constraint\00"
@.str.1 = [30 x i8] c"Unable to init from CIDR list\00"
define void @init_from_array(i8** nocapture %0, i64 %1, i32 %2, i32 %3) {
%5 = trunc i64 %1 to i32
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = icmp ne i32 %3, 0
%9 = and i64 %1, 4294967295
br label %11
10: ; preds = %20, %4
ret void
11: ; preds = %7, %20
%12 = phi i64 [ 0, %7 ], [ %21, %20 ]
%13 = getelementptr inbounds i8*, i8** %0, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @init_from_string(i8* %14, i32 %2)
%16 = icmp eq i32 %15, 0
%17 = or i1 %8, %16
br i1 %17, label %20, label %18
18: ; preds = %11
%19 = tail call i32 @log_fatal(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %11
%21 = add nuw nsw i64 %12, 1
%22 = icmp eq i64 %21, %9
br i1 %22, label %10, label %11
}