#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 dummy;
};
typedef int in_addr_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int INADDR_NONE;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int inet_addr(char *);
scalar_t__ inet_aton(char *, struct in_addr *);
char *inet_ntoa(struct in_addr);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  char *ind_dp = "207.97.227.239";
  in_addr_t ind;
  if ((ind = inet_addr(ind_dp)) == INADDR_NONE) {
    fprintf(stderr, "Err. inet_addr() - Invalid input: INADDR_NONE\n");
    exit(EXIT_FAILURE);
  }
  struct in_addr inp;
  if (inet_aton(ind_dp, &inp) == 0) {
    fprintf(stderr, "Err. inet_aton() %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  printf("Indirizzo IP formato di rete 32bit: %u\n", ind);
  printf("Indirizzo IP formato di rete 32bit: %s\n", inet_ntoa(inp));
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe73(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <inet_addr@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e44(%rip),%rcx
cmp    (%rcx),%eax
jne    11d1 <main+0x61>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
lea    0xe53(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1070 <inet_aton@plt>
cmp    $0x0,%rax
jne    1224 <main+0xb4>
mov    0x2de9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x24(%rbp),%edi
mov    %rax,%rdx
lea    0xe2f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x1c(%rbp),%esi
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d6b(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xe84(%rip),%rdi
call   1050 <inet_addr@plt>
mov    %eax,%ebx
mov    0x2e5e(%rip),%rax
cmp    (%rax),%ebx
je     11dd <main+0x6d>
lea    0xe6b(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1070 <inet_aton@plt>
test   %rax,%rax
je     11f6 <main+0x86>
lea    0xea8(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edi
call   1030 <inet_ntoa@plt>
lea    0xeb7(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2deb(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
lea    0xe22(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1220 <main+0xb0>
mov    0x2ddb(%rip),%rax
mov    (%rax),%ebx
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xe2a(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@.str = [15 x i8] c"207.97.227.239\00"
@INADDR_NONE = global i32 0
@stderr = global i32 0
@.str.1 = [47 x i8] c"Err. inet_addr() - Invalid input: INADDR_NONE\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [21 x i8] c"Err. inet_aton() %s\0A\00"
@errno = global i32 0
@.str.3 = [40 x i8] c"Indirizzo IP formato di rete 32bit: %u\0A\00"
@.str.4 = [40 x i8] c"Indirizzo IP formato di rete 32bit: %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.in_addr
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %6
%9 = load i8*, i8** %6
%10 = call i32 @inet_addr(i8* %9)
store i32 %10, i32* %7
%11 = load i32, i32* @INADDR_NONE
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%16 = load i32, i32* @EXIT_FAILURE
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %2
%19 = load i8*, i8** %6
%20 = call i64 @inet_aton(i8* %19, %struct.in_addr* %8)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %18
%23 = load i32, i32* @stderr
%24 = load i32, i32* @errno
%25 = call i8* @strerror(i32 %24)
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @EXIT_FAILURE
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %18
%30 = load i32, i32* %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %8, i32 0, i32 0
%33 = load i32, i32* %32
%34 = call i8* @inet_ntoa(i32 %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %34)
%36 = load i32, i32* @EXIT_SUCCESS
ret i32 %36
}

LLVM IR (-O2):
%struct.in_addr = type { i32 }
@.str = [15 x i8] c"207.97.227.239\00"
@INADDR_NONE = global i32 0
@stderr = global i32 0
@.str.1 = [47 x i8] c"Err. inet_addr() - Invalid input: INADDR_NONE\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [21 x i8] c"Err. inet_aton() %s\0A\00"
@errno = global i32 0
@.str.3 = [40 x i8] c"Indirizzo IP formato di rete 32bit: %u\0A\00"
@.str.4 = [40 x i8] c"Indirizzo IP formato di rete 32bit: %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.in_addr
%4 = tail call i32 @inet_addr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @INADDR_NONE
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %2
%13 = bitcast %struct.in_addr* %3 to i8*
%14 = call i64 @inet_aton(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %struct.in_addr* %3)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load i32, i32* @stderr
%18 = load i32, i32* @errno
%19 = call i8* @strerror(i32 %18)
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %12
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 %4)
%25 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i64 0, i32 0
%26 = load i32, i32* %25
%27 = call i8* @inet_ntoa(i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %27)
%29 = load i32, i32* @EXIT_SUCCESS
ret i32 %29
}