#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 */
typedef int /*<<< orphan*/ remote_host;
typedef int /*<<< orphan*/ localhost;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ init_test();
int /*<<< orphan*/ print_errno();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ tcp_ping(char *, int);
int main(void) {
  if (init_test() != 0) {
    printf("FAILURE init_test");
    print_errno();
    exit(EXIT_FAILURE);
  }
  char localhost[] = "127.0.0.1";
  tcp_ping(localhost, sizeof(localhost));
  char remote_host[] = "169.254.5.251";
  tcp_ping(remote_host, sizeof(remote_host));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1070 <init_test@plt>
cmp    $0x0,%rax
je     118a <main+0x3a>
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <print_errno@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    0xe81(%rip),%rax
mov    %rax,-0xa(%rbp)
mov    0xe7e(%rip),%ax
mov    %ax,-0x2(%rbp)
lea    -0xa(%rbp),%rdi
mov    $0xa,%esi
call   1050 <tcp_ping@plt>
mov    0xe67(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe65(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xe5f(%rip),%ax
mov    %ax,-0xc(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0xe,%esi
call   1050 <tcp_ping@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
xor    %eax,%eax
call   1070 <init_test@plt>
test   %rax,%rax
jne    11b9 <main+0x69>
movabs $0x2e302e302e373231,%rax
2e 30 2e
mov    %rax,0x8(%rsp)
movw   $0x31,0x10(%rsp)
lea    0x8(%rsp),%rdi
mov    $0xa,%esi
call   1050 <tcp_ping@plt>
movabs $0x3135322e352e34,%rax
mov    %rax,0x1e(%rsp)
movabs $0x2e3435322e393631,%rax
35 34 2e
mov    %rax,0x18(%rsp)
lea    0x18(%rsp),%rdi
mov    $0xe,%esi
call   1050 <tcp_ping@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret
lea    0xe40(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <print_errno@plt>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"FAILURE init_test\00"
@EXIT_FAILURE = global i32 0
@__const.main.localhost = [10 x i8] c"127.0.0.1\00"
@__const.main.remote_host = [14 x i8] c"169.254.5.251\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [14 x i8]
%3 = call i64 (...) @init_test()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @print_errno()
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %0
%11 = bitcast [10 x i8]* %1 to i8*
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%13 = call i32 @tcp_ping(i8* %12, i32 10)
%14 = bitcast [14 x i8]* %2 to i8*
%15 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%16 = call i32 @tcp_ping(i8* %15, i32 14)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"FAILURE init_test\00"
@EXIT_FAILURE = global i32 0
@__const.main.localhost = [10 x i8] c"127.0.0.1\00"
@__const.main.remote_host = [14 x i8] c"169.254.5.251\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [14 x i8]
%3 = tail call i64 (...) @init_test()
%4 = icmp eq i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %0
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @print_errno()
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %0
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%12 = call i32 @tcp_ping(i8* %11, i32 10)
%13 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%14 = call i32 @tcp_ping(i8* %13, i32 14)
ret i32 0
}