#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 */
struct ullist_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gethostentip(char *);
unsigned long inet_addr(int /*<<< orphan*/);
struct ullist_t *ullist_init(unsigned long);
struct ullist_t *ullist_push(struct ullist_t *, unsigned long);
struct ullist_t *ullist_conv_ips(char **ip_list) {
  int i = 0;
  struct ullist_t *base = (struct ullist_t *)0, *cur = (struct ullist_t *)0;
  unsigned long int ip;
  while (ip_list[i]) {
    ip = inet_addr(gethostentip(ip_list[i]));
    if (i == 0) {
      base = cur = ullist_init(ip);
    } else {
      cur = ullist_push(cur, ip);
    }
    i++;
  }
  return base;
}


x86 assembly (clang, -O0):
<ullist_conv_ips>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11d1 <ullist_conv_ips+0x91>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <gethostentip@plt>
mov    %eax,%edi
call   1040 <inet_addr@plt>
mov    %rax,-0x28(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11b2 <ullist_conv_ips+0x72>
mov    -0x28(%rbp),%rdi
call   1050 <ullist_init@plt>
mov    %rax,-0x20(%rbp)
mov    %rax,-0x18(%rbp)
jmp    11c3 <ullist_conv_ips+0x83>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <ullist_push@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1163 <ullist_conv_ips+0x23>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ullist_conv_ips>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     11a8 <ullist_conv_ips+0x68>
call   1060 <gethostentip@plt>
mov    %eax,%edi
call   1040 <inet_addr@plt>
mov    %rax,%rdi
call   1050 <ullist_init@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rdi
test   %rdi,%rdi
je     11ab <ullist_conv_ips+0x6b>
add    $0x10,%rbx
mov    %r14,%r15
nopw   0x0(%rax,%rax,1)
call   1060 <gethostentip@plt>
mov    %eax,%edi
call   1040 <inet_addr@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   1030 <ullist_push@plt>
mov    %rax,%r15
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1180 <ullist_conv_ips+0x40>
jmp    11ab <ullist_conv_ips+0x6b>
xor    %r14d,%r14d
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.ullist_t = type { i32 }
define %struct.ullist_t* @ullist_conv_ips(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
%4 = alloca %struct.ullist_t*
%5 = alloca %struct.ullist_t*
%6 = alloca i64
store i8** %0, i8*** %2
store i32 0, i32* %3
store %struct.ullist_t* null, %struct.ullist_t** %4
store %struct.ullist_t* null, %struct.ullist_t** %5
br label %7
7: ; preds = %31, %1
%8 = load i8**, i8*** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8*, i8** %8, i64 %10
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %34
14: ; preds = %7
%15 = load i8**, i8*** %2
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @gethostentip(i8* %19)
%21 = call i64 @inet_addr(i32 %20)
store i64 %21, i64* %6
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %14
%25 = load i64, i64* %6
%26 = call %struct.ullist_t* @ullist_init(i64 %25)
store %struct.ullist_t* %26, %struct.ullist_t** %5
store %struct.ullist_t* %26, %struct.ullist_t** %4
br label %31
27: ; preds = %14
%28 = load %struct.ullist_t*, %struct.ullist_t** %5
%29 = load i64, i64* %6
%30 = call %struct.ullist_t* @ullist_push(%struct.ullist_t* %28, i64 %29)
store %struct.ullist_t* %30, %struct.ullist_t** %5
br label %31
31: ; preds = %27, %24
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %7
34: ; preds = %7
%35 = load %struct.ullist_t*, %struct.ullist_t** %4
ret %struct.ullist_t* %35
}

LLVM IR (-O2):
%struct.ullist_t = type { i32 }
define %struct.ullist_t* @ullist_conv_ips(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %22, label %4
4: ; preds = %1
%5 = tail call i32 @gethostentip(i8* %2)
%6 = tail call i64 @inet_addr(i32 %5)
%7 = tail call %struct.ullist_t* @ullist_init(i64 %6)
%8 = getelementptr inbounds i8*, i8** %0, i64 1
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %22, label %11
11: ; preds = %4, %11
%12 = phi i64 [ %18, %11 ], [ 1, %4 ]
%13 = phi i8* [ %20, %11 ], [ %9, %4 ]
%14 = phi %struct.ullist_t* [ %17, %11 ], [ %7, %4 ]
%15 = tail call i32 @gethostentip(i8* %13)
%16 = tail call i64 @inet_addr(i32 %15)
%17 = tail call %struct.ullist_t* @ullist_push(%struct.ullist_t* %14, i64 %16)
%18 = add nuw i64 %12, 1
%19 = getelementptr inbounds i8*, i8** %0, i64 %18
%20 = load i8*, i8** %19
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %11
22: ; preds = %11, %4, %1
%23 = phi %struct.ullist_t* [ null, %1 ], [ %7, %4 ], [ %7, %11 ]
ret %struct.ullist_t* %23
}