#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*/ validate_ipv4_negate(char const *);
int /*<<< orphan*/ validate_ipv4net_negate(char const *);
int /*<<< orphan*/ validate_ipv4range_negate(char const *);
int validate_iptables4_addr(const char *str) {
  if (!str)
    return 0;
  if (!validate_ipv4_negate(str) && !validate_ipv4net_negate(str) &&
      !validate_ipv4range_negate(str))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<validate_iptables4_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1153 <validate_iptables4_addr+0x23>
movl   $0x0,-0x4(%rbp)
jmp    119c <validate_iptables4_addr+0x6c>
mov    -0x10(%rbp),%rdi
call   1030 <validate_ipv4_negate@plt>
cmp    $0x0,%eax
jne    1195 <validate_iptables4_addr+0x65>
mov    -0x10(%rbp),%rdi
call   1050 <validate_ipv4net_negate@plt>
cmp    $0x0,%eax
jne    1195 <validate_iptables4_addr+0x65>
mov    -0x10(%rbp),%rdi
call   1040 <validate_ipv4range_negate@plt>
cmp    $0x0,%eax
jne    1195 <validate_iptables4_addr+0x65>
movl   $0x0,-0x4(%rbp)
jmp    119c <validate_iptables4_addr+0x6c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_iptables4_addr>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     1163 <validate_iptables4_addr+0x33>
mov    %rdi,%rbx
call   1030 <validate_ipv4_negate@plt>
test   %eax,%eax
jne    115e <validate_iptables4_addr+0x2e>
mov    %rbx,%rdi
call   1050 <validate_ipv4net_negate@plt>
test   %eax,%eax
jne    115e <validate_iptables4_addr+0x2e>
mov    %rbx,%rdi
call   1040 <validate_ipv4range_negate@plt>
test   %eax,%eax
je     1163 <validate_iptables4_addr+0x33>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @validate_iptables4_addr(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i32 0, i32* %2
br label %21
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @validate_ipv4_negate(i8* %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %20, label %11
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = call i32 @validate_ipv4net_negate(i8* %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = call i32 @validate_ipv4range_negate(i8* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %15
store i32 0, i32* %2
br label %21
20: ; preds = %15, %11, %7
store i32 1, i32* %2
br label %21
21: ; preds = %20, %19, %6
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @validate_iptables4_addr(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = tail call i32 @validate_ipv4_negate(i8* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = tail call i32 @validate_ipv4net_negate(i8* %0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = tail call i32 @validate_ipv4range_negate(i8* %0)
%11 = icmp eq i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %9, %6, %3
br label %13
13: ; preds = %9, %1, %12
%14 = phi i32 [ 1, %12 ], [ 0, %1 ], [ 0, %9 ]
ret i32 %14
}