#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*/ exit_program(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int inet_pton(int, char const *, void *);
int /*<<< orphan*/ stdin;
void Inet_pton(int family, const char *ip, void *addptr) {
  int n;
  if ((n = inet_pton(family, ip, addptr)) <= 0) {
    if (n == 0)
      fprintf(stdin, "inet_pton format error : %s\n", ip);
    else
      fprintf(stdin, "inet_pton error : %s\n", ip);
    exit_program(1);
  }
}


x86 assembly (clang, -O0):
<Inet_pton>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <inet_pton@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jg     11aa <Inet_pton+0x7a>
cmpl   $0x0,-0x1c(%rbp)
jne    1187 <Inet_pton+0x57>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe83(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11a0 <Inet_pton+0x70>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe82(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit_program@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Inet_pton>:
push   %rbx
mov    %rsi,%rbx
call   1040 <inet_pton@plt>
test   %eax,%eax
jle    113f <Inet_pton+0xf>
pop    %rbx
ret
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rax
lea    0xec7(%rip),%rsi
cmove  %rax,%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
pop    %rbx
jmp    1050 <exit_program@plt>

LLVM IR (-O0):
@stdin = global i32 0
@.str = [29 x i8] c"inet_pton format error : %s\0A\00"
@.str.1 = [22 x i8] c"inet_pton error : %s\0A\00"
define void @Inet_pton(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i32 @inet_pton(i32 %8, i8* %9, i8* %10)
store i32 %11, i32* %7
%12 = icmp sle i32 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %3
%14 = load i32, i32* %7
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* @stdin
%18 = load i8*, i8** %5
%19 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %24
20: ; preds = %13
%21 = load i32, i32* @stdin
%22 = load i8*, i8** %5
%23 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %20, %16
%25 = call i32 @exit_program(i32 1)
br label %26
26: ; preds = %24, %3
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [29 x i8] c"inet_pton format error : %s\0A\00"
@.str.1 = [22 x i8] c"inet_pton error : %s\0A\00"
define void @Inet_pton(i32 %0, i8* %1, i8* %2) {
%4 = tail call i32 @inet_pton(i32 %0, i8* %1, i8* %2)
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = icmp eq i32 %4, 0
%8 = load i32, i32* @stdin
%9 = select i1 %7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0)
%10 = tail call i32 @fprintf(i32 %8, i8* %9, i8* %1)
%11 = tail call i32 @exit_program(i32 1)
br label %12
12: ; preds = %6, %3
ret void
}