#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(int /*<<< orphan*/);
unsigned int gethostinfo(unsigned int *, unsigned int *);
int /*<<< orphan*/ uint_to_string(unsigned int, unsigned char *);
int /*<<< orphan*/ write(int, ...);
int main(void) {
  unsigned int tool_ip;
  unsigned int tool_port;
  unsigned int our_ip;
  unsigned char tmp[9];
  write(1, "dcload gethostinfo test program\n\n", 33);
  our_ip = gethostinfo(&tool_ip, &tool_port);
  uint_to_string(our_ip, tmp);
  write(1, "our ip = 0x", 11);
  write(1, tmp, 9);
  write(1, "\n", 1);
  uint_to_string(tool_ip, tmp);
  write(1, "tool ip = 0x", 12);
  write(1, tmp, 9);
  write(1, "\n", 1);
  uint_to_string(tool_port, tmp);
  write(1, "tool port = 0x", 14);
  write(1, tmp, 9);
  write(1, "\n", 1);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
lea    0xea5(%rip),%rsi
mov    $0x21,%edx
mov    $0x0,%al
call   1040 <write@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <gethostinfo@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
lea    -0x19(%rbp),%rsi
call   1030 <uint_to_string@plt>
mov    $0x1,%edi
lea    0xe93(%rip),%rsi
mov    $0xb,%edx
mov    $0x0,%al
call   1040 <write@plt>
lea    -0x19(%rbp),%rsi
mov    $0x1,%edi
mov    $0x9,%edx
mov    $0x0,%al
call   1040 <write@plt>
mov    $0x1,%edx
lea    0xe64(%rip),%rsi
mov    %edx,%edi
mov    $0x0,%al
call   1040 <write@plt>
mov    -0x8(%rbp),%edi
lea    -0x19(%rbp),%rsi
call   1030 <uint_to_string@plt>
mov    $0x1,%edi
lea    0xe51(%rip),%rsi
mov    $0xc,%edx
mov    $0x0,%al
call   1040 <write@plt>
lea    -0x19(%rbp),%rsi
mov    $0x1,%edi
mov    $0x9,%edx
mov    $0x0,%al
call   1040 <write@plt>
mov    $0x1,%edx
lea    0xe16(%rip),%rsi
mov    %edx,%edi
mov    $0x0,%al
call   1040 <write@plt>
mov    -0xc(%rbp),%edi
lea    -0x19(%rbp),%rsi
call   1030 <uint_to_string@plt>
mov    $0x1,%edi
lea    0xe10(%rip),%rsi
mov    $0xe,%edx
mov    $0x0,%al
call   1040 <write@plt>
lea    -0x19(%rbp),%rsi
mov    $0x1,%edi
mov    $0x9,%edx
mov    $0x0,%al
call   1040 <write@plt>
mov    $0x1,%edx
lea    0xdc8(%rip),%rsi
mov    %edx,%edi
mov    $0x0,%al
call   1040 <write@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeb2(%rip),%rsi
mov    $0x1,%edi
mov    $0x21,%edx
xor    %eax,%eax
call   1040 <write@plt>
lea    0x8(%rsp),%rdi
lea    0x4(%rsp),%rsi
call   1050 <gethostinfo@plt>
lea    0xf(%rsp),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
call   1030 <uint_to_string@plt>
lea    0xe9e(%rip),%rsi
mov    $0x1,%edi
mov    $0xb,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x9,%edx
xor    %eax,%eax
call   1040 <write@plt>
lea    0xe70(%rip),%r14
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    0x8(%rsp),%edi
mov    %rbx,%rsi
call   1030 <uint_to_string@plt>
lea    0xe57(%rip),%rsi
mov    $0x1,%edi
mov    $0xc,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x9,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    0x4(%rsp),%edi
mov    %rbx,%rsi
call   1030 <uint_to_string@plt>
lea    0xe18(%rip),%rsi
mov    $0x1,%edi
mov    $0xe,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x9,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <write@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"dcload gethostinfo test program\0A\0A\00"
@.str.1 = [12 x i8] c"our ip = 0x\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [13 x i8] c"tool ip = 0x\00"
@.str.4 = [15 x i8] c"tool port = 0x\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [9 x i8]
store i32 0, i32* %1
%6 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 33)
%7 = call i32 @gethostinfo(i32* %2, i32* %3)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%10 = call i32 @uint_to_string(i32 %8, i8* %9)
%11 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 11)
%12 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%13 = call i32 (i32, ...) @write(i32 1, i8* %12, i32 9)
%14 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%15 = load i32, i32* %2
%16 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%17 = call i32 @uint_to_string(i32 %15, i8* %16)
%18 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 12)
%19 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%20 = call i32 (i32, ...) @write(i32 1, i8* %19, i32 9)
%21 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%22 = load i32, i32* %3
%23 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%24 = call i32 @uint_to_string(i32 %22, i8* %23)
%25 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 14)
%26 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%27 = call i32 (i32, ...) @write(i32 1, i8* %26, i32 9)
%28 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%29 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [34 x i8] c"dcload gethostinfo test program\0A\0A\00"
@.str.1 = [12 x i8] c"our ip = 0x\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [13 x i8] c"tool ip = 0x\00"
@.str.4 = [15 x i8] c"tool port = 0x\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [9 x i8]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%7 = tail call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 33)
%8 = call i32 @gethostinfo(i32* %1, i32* %2)
%9 = call i32 @uint_to_string(i32 %8, i8* %6)
%10 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 11)
%11 = call i32 (i32, ...) @write(i32 1, i8* %6, i32 9)
%12 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%13 = load i32, i32* %1
%14 = call i32 @uint_to_string(i32 %13, i8* %6)
%15 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 12)
%16 = call i32 (i32, ...) @write(i32 1, i8* %6, i32 9)
%17 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%18 = load i32, i32* %2
%19 = call i32 @uint_to_string(i32 %18, i8* %6)
%20 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 14)
%21 = call i32 (i32, ...) @write(i32 1, i8* %6, i32 9)
%22 = call i32 (i32, ...) @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%23 = call i32 @exit(i32 0)
unreachable
}