#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 in_addr {
  int s_addr;
};

/* Variables and functions */
int /*<<< orphan*/ LOG_ERR;
void *htonl(unsigned int);
int sscanf(char *, char *, unsigned int *, unsigned int *, unsigned int *,
           unsigned int *, unsigned int *, unsigned int *, unsigned int *,
           unsigned int *);
int /*<<< orphan*/ sys_err(int /*<<< orphan*/, char *, int, int /*<<< orphan*/,
                           char *);
int ippool_aton(struct in_addr *addr, struct in_addr *mask, char *pool,
                int number) {
  unsigned int a1, a2, a3, a4;
  unsigned int m1, m2, m3, m4;
  int c;
  int m;
  int masklog;
  c = sscanf(pool, "%u.%u.%u.%u/%u.%u.%u.%u", &a1, &a2, &a3, &a4, &m1, &m2, &m3,
             &m4);
  switch (c) {
  case 4:
    mask->s_addr = 0xffffffff;
    break;
  case 5:
    if (m1 > 32) {
      sys_err(LOG_ERR,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/chantra/openggsn/refs/heads/master/"
              "ggsn/ippool.c",
              125, 0, "Invalid mask");
      return -1;
    }
    mask->s_addr = htonl(0xffffffff << (32 - m1));
    break;
  case 8:
    if (m1 >= 256 || m2 >= 256 || m3 >= 256 || m4 >= 256) {
      sys_err(LOG_ERR,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/chantra/openggsn/refs/heads/master/"
              "ggsn/ippool.c",
              132, 0, "Invalid mask");
      return -1;
    }
    m = m1 * 0x1000000 + m2 * 0x10000 + m3 * 0x100 + m4;
    for (masklog = 0; ((1 << masklog) < ((~m) + 1)); masklog++)
      ;
    if (((~m) + 1) != (1 << masklog)) {
      sys_err(LOG_ERR,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/chantra/openggsn/refs/heads/master/"
              "ggsn/ippool.c",
              138, 0, "Invalid mask");
      return -1;
    }
    mask->s_addr = htonl(m);
    break;
  default:
    sys_err(LOG_ERR,
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/chantra/openggsn/refs/heads/master/ggsn/"
            "ippool.c",
            144, 0, "Invalid mask");
    return -1;
  }
  if (a1 >= 256 || a2 >= 256 || a3 >= 256 || a4 >= 256) {
    sys_err(LOG_ERR,
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/chantra/openggsn/refs/heads/master/ggsn/"
            "ippool.c",
            149, 0, "Wrong IP address format");
    return -1;
  } else
    addr->s_addr = htonl(a1 * 0x1000000 + a2 * 0x10000 + a3 * 0x100 + a4);
  return 0;
}


x86 assembly (clang, -O0):
<ippool_aton>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    %rsp,%rax
lea    -0x44(%rbp),%rcx
mov    %rcx,0x18(%rax)
lea    -0x40(%rbp),%rcx
mov    %rcx,0x10(%rax)
lea    -0x3c(%rbp),%rcx
mov    %rcx,0x8(%rax)
lea    -0x38(%rbp),%rcx
mov    %rcx,(%rax)
lea    0xe89(%rip),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
lea    -0x30(%rbp),%r8
lea    -0x34(%rbp),%r9
call   1040 <sscanf@plt>
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x54(%rbp)
sub    $0x4,%eax
je     11c5 <ippool_aton+0x95>
jmp    11a3 <ippool_aton+0x73>
mov    -0x54(%rbp),%eax
sub    $0x5,%eax
je     11d4 <ippool_aton+0xa4>
jmp    11b4 <ippool_aton+0x84>
mov    -0x54(%rbp),%eax
sub    $0x8,%eax
je     122e <ippool_aton+0xfe>
jmp    1343 <ippool_aton+0x213>
mov    -0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    1372 <ippool_aton+0x242>
cmpl   $0x20,-0x38(%rbp)
jbe    120d <ippool_aton+0xdd>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
lea    0xe2a(%rip),%rsi
mov    $0x7d,%edx
xor    %ecx,%ecx
lea    0xea7(%rip),%r8
call   1050 <sys_err@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1402 <ippool_aton+0x2d2>
mov    $0x20,%ecx
sub    -0x38(%rbp),%ecx
mov    $0xffffffff,%edi
shl    %cl,%edi
call   1030 <htonl@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1372 <ippool_aton+0x242>
cmpl   $0x100,-0x38(%rbp)
jae    1262 <ippool_aton+0x132>
cmpl   $0x100,-0x3c(%rbp)
jae    1262 <ippool_aton+0x132>
cmpl   $0x100,-0x40(%rbp)
jae    1262 <ippool_aton+0x132>
cmpl   $0x100,-0x44(%rbp)
jb     1291 <ippool_aton+0x161>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
lea    0xda6(%rip),%rsi
mov    $0x84,%edx
xor    %ecx,%ecx
lea    0xe23(%rip),%r8
call   1050 <sys_err@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1402 <ippool_aton+0x2d2>
mov    -0x38(%rbp),%eax
shl    $0x18,%eax
mov    -0x3c(%rbp),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x40(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    -0x4c(%rbp),%ecx
xor    $0xffffffff,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    12e2 <ippool_aton+0x1b2>
jmp    12d4 <ippool_aton+0x1a4>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    12b4 <ippool_aton+0x184>
mov    -0x4c(%rbp),%eax
xor    $0xffffffff,%eax
add    $0x1,%eax
mov    -0x50(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
je     132e <ippool_aton+0x1fe>
mov    0x2cd2(%rip),%rax
mov    (%rax),%edi
lea    0xd09(%rip),%rsi
mov    $0x8a,%edx
xor    %ecx,%ecx
lea    0xd86(%rip),%r8
call   1050 <sys_err@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1402 <ippool_aton+0x2d2>
mov    -0x4c(%rbp),%edi
call   1030 <htonl@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1372 <ippool_aton+0x242>
mov    0x2c8e(%rip),%rax
mov    (%rax),%edi
lea    0xcc5(%rip),%rsi
mov    $0x90,%edx
xor    %ecx,%ecx
lea    0xd42(%rip),%r8
call   1050 <sys_err@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1402 <ippool_aton+0x2d2>
cmpl   $0x100,-0x28(%rbp)
jae    13a6 <ippool_aton+0x276>
cmpl   $0x100,-0x2c(%rbp)
jae    13a6 <ippool_aton+0x276>
cmpl   $0x100,-0x30(%rbp)
jae    13a6 <ippool_aton+0x276>
cmpl   $0x100,-0x34(%rbp)
jb     13d5 <ippool_aton+0x2a5>
mov    0x2c2b(%rip),%rax
mov    (%rax),%edi
lea    0xc62(%rip),%rsi
mov    $0x95,%edx
xor    %ecx,%ecx
lea    0xcec(%rip),%r8
call   1050 <sys_err@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1402 <ippool_aton+0x2d2>
mov    -0x28(%rbp),%edi
shl    $0x18,%edi
mov    -0x2c(%rbp),%eax
shl    $0x10,%eax
add    %eax,%edi
mov    -0x30(%rbp),%eax
shl    $0x8,%eax
add    %eax,%edi
add    -0x34(%rbp),%edi
call   1030 <htonl@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ippool_aton>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%rax
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xc(%rsp),%rbx
lea    0x10(%rsp),%r10
lea    0x14(%rsp),%r11
lea    0x8(%rsp),%r12
lea    0xea1(%rip),%rsi
lea    0x24(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x1c(%rsp),%r8
lea    0x18(%rsp),%r9
mov    %rax,%rdi
push   %rbx
push   %r10
push   %r11
push   %r12
call   1040 <sscanf@plt>
add    $0x20,%rsp
cmp    $0x4,%eax
je     1251 <ippool_aton+0x121>
cmp    $0x8,%eax
je     11cb <ippool_aton+0x9b>
cmp    $0x5,%eax
jne    1258 <ippool_aton+0x128>
mov    0x8(%rsp),%ecx
cmp    $0x21,%ecx
jb     1297 <ippool_aton+0x167>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
lea    0xe5e(%rip),%rsi
lea    0xee2(%rip),%r8
mov    $0x7d,%edx
jmp    130e <ippool_aton+0x1de>
mov    0x8(%rsp),%eax
cmp    $0xff,%eax
ja     1279 <ippool_aton+0x149>
mov    0x14(%rsp),%ecx
cmp    $0xff,%ecx
ja     1279 <ippool_aton+0x149>
mov    0x10(%rsp),%edi
cmp    $0xff,%edi
ja     1279 <ippool_aton+0x149>
mov    0xc(%rsp),%edx
cmp    $0x100,%edx
jae    1279 <ippool_aton+0x149>
shl    $0x18,%eax
shl    $0x10,%ecx
add    %eax,%ecx
shl    $0x8,%edi
add    %ecx,%edi
add    %edx,%edi
mov    %edi,%eax
neg    %eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edx
shl    %cl,%edx
add    $0x1,%ecx
cmp    %eax,%edx
jl     1220 <ippool_aton+0xf0>
je     12a0 <ippool_aton+0x170>
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
lea    0xdd8(%rip),%rsi
lea    0xe5c(%rip),%r8
mov    $0x8a,%edx
jmp    130e <ippool_aton+0x1de>
mov    $0xffffffff,%eax
jmp    12a5 <ippool_aton+0x175>
mov    0x2d79(%rip),%rax
mov    (%rax),%edi
lea    0xdb0(%rip),%rsi
lea    0xe34(%rip),%r8
mov    $0x90,%edx
jmp    130e <ippool_aton+0x1de>
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
lea    0xd8f(%rip),%rsi
lea    0xe13(%rip),%r8
mov    $0x84,%edx
jmp    130e <ippool_aton+0x1de>
neg    %cl
mov    $0xffffffff,%edi
shl    %cl,%edi
call   1030 <htonl@plt>
mov    %eax,(%r15)
mov    0x24(%rsp),%eax
cmp    $0xff,%eax
ja     12f2 <ippool_aton+0x1c2>
mov    0x20(%rsp),%ecx
cmp    $0xff,%ecx
ja     12f2 <ippool_aton+0x1c2>
mov    0x1c(%rsp),%edi
cmp    $0xff,%edi
ja     12f2 <ippool_aton+0x1c2>
mov    0x18(%rsp),%edx
cmp    $0x100,%edx
jae    12f2 <ippool_aton+0x1c2>
shl    $0x18,%eax
shl    $0x10,%ecx
add    %eax,%ecx
shl    $0x8,%edi
add    %ecx,%edi
add    %edx,%edi
call   1030 <htonl@plt>
mov    %eax,(%r14)
xor    %eax,%eax
jmp    131a <ippool_aton+0x1ea>
mov    0x2cdf(%rip),%rax
mov    (%rax),%edi
lea    0xd16(%rip),%rsi
lea    0xda7(%rip),%r8
mov    $0x95,%edx
xor    %ecx,%ecx
call   1050 <sys_err@plt>
mov    $0xffffffff,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@.str = [24 x i8] c"%u.%u.%u.%u/%u.%u.%u.%u\00"
@LOG_ERR = global i32 0
@.str.1 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/chantra/openggsn/refs/heads/master/ggsn/ippool.c\00"
@.str.2 = [13 x i8] c"Invalid mask\00"
@.str.3 = [24 x i8] c"Wrong IP address format\00"
define i32 @ippool_aton(%struct.in_addr* %0, %struct.in_addr* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.in_addr*
%7 = alloca %struct.in_addr*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store %struct.in_addr* %0, %struct.in_addr** %6
store %struct.in_addr* %1, %struct.in_addr** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%21 = load i8*, i8** %8
%22 = call i32 @sscanf(i8* %21, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32* %10, i32* %11, i32* %12, i32* %13, i32* %14, i32* %15, i32* %16, i32* %17)
store i32 %22, i32* %18
%23 = load i32, i32* %18
switch i32 %23, label %94 [
i32 4, label %24
i32 5, label %27
i32 8, label %41
]
24: ; preds = %4
%25 = load %struct.in_addr*, %struct.in_addr** %7
%26 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %25, i32 0, i32 0
store i32 -1, i32* %26
br label %97
27: ; preds = %4
%28 = load i32, i32* %14
%29 = icmp ugt i32 %28, 32
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* @LOG_ERR
%32 = call i32 @sys_err(i32 %31, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 125, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %5
br label %128
33: ; preds = %27
%34 = load i32, i32* %14
%35 = sub i32 32, %34
%36 = shl i32 -1, %35
%37 = call i8* @htonl(i32 %36)
%38 = ptrtoint i8* %37 to i32
%39 = load %struct.in_addr*, %struct.in_addr** %7
%40 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %39, i32 0, i32 0
store i32 %38, i32* %40
br label %97
41: ; preds = %4
%42 = load i32, i32* %14
%43 = icmp uge i32 %42, 256
br i1 %43, label %53, label %44
44: ; preds = %41
%45 = load i32, i32* %15
%46 = icmp uge i32 %45, 256
br i1 %46, label %53, label %47
47: ; preds = %44
%48 = load i32, i32* %16
%49 = icmp uge i32 %48, 256
br i1 %49, label %53, label %50
50: ; preds = %47
%51 = load i32, i32* %17
%52 = icmp uge i32 %51, 256
br i1 %52, label %53, label %56
53: ; preds = %50, %47, %44, %41
%54 = load i32, i32* @LOG_ERR
%55 = call i32 @sys_err(i32 %54, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 132, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %5
br label %128
56: ; preds = %50
%57 = load i32, i32* %14
%58 = mul i32 %57, 16777216
%59 = load i32, i32* %15
%60 = mul i32 %59, 65536
%61 = add i32 %58, %60
%62 = load i32, i32* %16
%63 = mul i32 %62, 256
%64 = add i32 %61, %63
%65 = load i32, i32* %17
%66 = add i32 %64, %65
store i32 %66, i32* %19
store i32 0, i32* %20
br label %67
67: ; preds = %75, %56
%68 = load i32, i32* %20
%69 = shl i32 1, %68
%70 = load i32, i32* %19
%71 = xor i32 %70, -1
%72 = add nsw i32 %71, 1
%73 = icmp slt i32 %69, %72
br i1 %73, label %74, label %78
74: ; preds = %67
br label %75
75: ; preds = %74
%76 = load i32, i32* %20
%77 = add nsw i32 %76, 1
store i32 %77, i32* %20
br label %67
78: ; preds = %67
%79 = load i32, i32* %19
%80 = xor i32 %79, -1
%81 = add nsw i32 %80, 1
%82 = load i32, i32* %20
%83 = shl i32 1, %82
%84 = icmp ne i32 %81, %83
br i1 %84, label %85, label %88
85: ; preds = %78
%86 = load i32, i32* @LOG_ERR
%87 = call i32 @sys_err(i32 %86, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 138, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %5
br label %128
88: ; preds = %78
%89 = load i32, i32* %19
%90 = call i8* @htonl(i32 %89)
%91 = ptrtoint i8* %90 to i32
%92 = load %struct.in_addr*, %struct.in_addr** %7
%93 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %92, i32 0, i32 0
store i32 %91, i32* %93
br label %97
94: ; preds = %4
%95 = load i32, i32* @LOG_ERR
%96 = call i32 @sys_err(i32 %95, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 144, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %5
br label %128
97: ; preds = %88, %33, %24
%98 = load i32, i32* %10
%99 = icmp uge i32 %98, 256
br i1 %99, label %109, label %100
100: ; preds = %97
%101 = load i32, i32* %11
%102 = icmp uge i32 %101, 256
br i1 %102, label %109, label %103
103: ; preds = %100
%104 = load i32, i32* %12
%105 = icmp uge i32 %104, 256
br i1 %105, label %109, label %106
106: ; preds = %103
%107 = load i32, i32* %13
%108 = icmp uge i32 %107, 256
br i1 %108, label %109, label %112
109: ; preds = %106, %103, %100, %97
%110 = load i32, i32* @LOG_ERR
%111 = call i32 @sys_err(i32 %110, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 149, i32 0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %5
br label %128
112: ; preds = %106
%113 = load i32, i32* %10
%114 = mul i32 %113, 16777216
%115 = load i32, i32* %11
%116 = mul i32 %115, 65536
%117 = add i32 %114, %116
%118 = load i32, i32* %12
%119 = mul i32 %118, 256
%120 = add i32 %117, %119
%121 = load i32, i32* %13
%122 = add i32 %120, %121
%123 = call i8* @htonl(i32 %122)
%124 = ptrtoint i8* %123 to i32
%125 = load %struct.in_addr*, %struct.in_addr** %6
%126 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %125, i32 0, i32 0
store i32 %124, i32* %126
br label %127
127: ; preds = %112
store i32 0, i32* %5
br label %128
128: ; preds = %127, %109, %94, %85, %53, %30
%129 = load i32, i32* %5
ret i32 %129
}

LLVM IR (-O2):
%struct.in_addr = type { i32 }
@.str = [24 x i8] c"%u.%u.%u.%u/%u.%u.%u.%u\00"
@LOG_ERR = global i32 0
@.str.1 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/chantra/openggsn/refs/heads/master/ggsn/ippool.c\00"
@.str.2 = [13 x i8] c"Invalid mask\00"
@.str.3 = [24 x i8] c"Wrong IP address format\00"
define i32 @ippool_aton(%struct.in_addr* nocapture writeonly %0, %struct.in_addr* nocapture writeonly %1, i8* nocapture %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = bitcast i32* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = bitcast i32* %8 to i8*
%17 = bitcast i32* %9 to i8*
%18 = bitcast i32* %10 to i8*
%19 = bitcast i32* %11 to i8*
%20 = bitcast i32* %12 to i8*
%21 = call i32 @sscanf(i8* %2, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32* %12)
switch i32 %21, label %64 [
i32 4, label %72
i32 5, label %22
i32 8, label %31
]
22: ; preds = %4
%23 = load i32, i32* %9
%24 = icmp ugt i32 %23, 32
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* @LOG_ERR
%27 = call i32 @sys_err(i32 %26, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 125, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %100
28: ; preds = %22
%29 = sub nuw nsw i32 32, %23
%30 = shl nsw i32 -1, %29
br label %67
31: ; preds = %4
%32 = load i32, i32* %9
%33 = icmp ugt i32 %32, 255
%34 = load i32, i32* %10
%35 = icmp ugt i32 %34, 255
%36 = select i1 %33, i1 true, i1 %35
%37 = load i32, i32* %11
%38 = icmp ugt i32 %37, 255
%39 = select i1 %36, i1 true, i1 %38
%40 = load i32, i32* %12
%41 = icmp ugt i32 %40, 255
%42 = select i1 %39, i1 true, i1 %41
br i1 %42, label %43, label %46
43: ; preds = %31
%44 = load i32, i32* @LOG_ERR
%45 = call i32 @sys_err(i32 %44, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 132, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %100
46: ; preds = %31
%47 = shl nuw i32 %32, 24
%48 = shl nuw nsw i32 %34, 16
%49 = add nuw i32 %48, %47
%50 = shl nuw nsw i32 %37, 8
%51 = add nuw i32 %49, %50
%52 = add nuw i32 %51, %40
%53 = sub i32 0, %52
br label %54
54: ; preds = %54, %46
%55 = phi i32 [ 0, %46 ], [ %58, %54 ]
%56 = shl nuw i32 1, %55
%57 = icmp slt i32 %56, %53
%58 = add nuw nsw i32 %55, 1
br i1 %57, label %54, label %59
59: ; preds = %54
%60 = icmp eq i32 %56, %53
br i1 %60, label %67, label %61
61: ; preds = %59
%62 = load i32, i32* @LOG_ERR
%63 = call i32 @sys_err(i32 %62, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 138, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %100
64: ; preds = %4
%65 = load i32, i32* @LOG_ERR
%66 = call i32 @sys_err(i32 %65, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 144, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %100
67: ; preds = %59, %28
%68 = phi i32 [ %30, %28 ], [ %52, %59 ]
%69 = call i8* @htonl(i32 %68)
%70 = ptrtoint i8* %69 to i64
%71 = trunc i64 %70 to i32
br label %72
72: ; preds = %67, %4
%73 = phi i32 [ -1, %4 ], [ %71, %67 ]
%74 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %1, i64 0, i32 0
store i32 %73, i32* %74
%75 = load i32, i32* %5
%76 = icmp ugt i32 %75, 255
%77 = load i32, i32* %6
%78 = icmp ugt i32 %77, 255
%79 = select i1 %76, i1 true, i1 %78
%80 = load i32, i32* %7
%81 = icmp ugt i32 %80, 255
%82 = select i1 %79, i1 true, i1 %81
%83 = load i32, i32* %8
%84 = icmp ugt i32 %83, 255
%85 = select i1 %82, i1 true, i1 %84
br i1 %85, label %86, label %89
86: ; preds = %72
%87 = load i32, i32* @LOG_ERR
%88 = call i32 @sys_err(i32 %87, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 149, i32 0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %100
89: ; preds = %72
%90 = shl nuw i32 %75, 24
%91 = shl nuw nsw i32 %77, 16
%92 = add nuw i32 %91, %90
%93 = shl nuw nsw i32 %80, 8
%94 = add nuw i32 %92, %93
%95 = add nuw i32 %94, %83
%96 = call i8* @htonl(i32 %95)
%97 = ptrtoint i8* %96 to i64
%98 = trunc i64 %97 to i32
%99 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %0, i64 0, i32 0
store i32 %98, i32* %99
br label %100
100: ; preds = %89, %86, %64, %61, %43, %25
%101 = phi i32 [ -1, %64 ], [ -1, %43 ], [ -1, %61 ], [ -1, %86 ], [ 0, %89 ], [ -1, %25 ]
ret i32 %101
}