#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 s_addr;
};

/* Variables and functions */
int /*<<< orphan*/ test_host();
int /*<<< orphan*/ test_host2(char *);
int /*<<< orphan*/ test_host3(struct in_addr *);
int /*<<< orphan*/ test_net();
int /*<<< orphan*/ test_net2(char *);
int /*<<< orphan*/ test_net3(int);
int /*<<< orphan*/ test_proto();
int /*<<< orphan*/ test_proto2(char *);
int /*<<< orphan*/ test_proto3(int);
int /*<<< orphan*/ test_serv();
int /*<<< orphan*/ test_serv2(char *);
int /*<<< orphan*/ test_serv3(int);
int main(int argc, char *argv[]) {
  test_host();
  test_host2("localhost");
  test_host2("www.baidu.com");
  test_host2("gux.glodon.com");
  struct in_addr addr;
  addr.s_addr = 0x0100007f;
  test_host3(&addr);
  addr.s_addr = 0xdf38810a;
  test_host3(&addr);
  test_net();
  test_net2("default");
  test_net2("loopback");
  test_net2("eth0");
  test_net3(0x7f000000);
  test_net3(0x0a8138df);
  test_proto();
  test_proto2("tcp");
  test_proto2("raw");
  test_proto3(136);
  test_proto3(224);
  test_serv();
  test_serv2("http");
  test_serv2("abcd");
  test_serv3(80);
  test_serv3(8080);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   10d0 <test_host@plt>
lea    0xe1c(%rip),%rdi
call   10a0 <test_host2@plt>
lea    0xe1a(%rip),%rdi
call   10a0 <test_host2@plt>
lea    0xe1c(%rip),%rdi
call   10a0 <test_host2@plt>
movl   $0x100007f,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <test_host3@plt>
movl   $0xdf38810a,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <test_host3@plt>
mov    $0x0,%al
call   1070 <test_net@plt>
lea    0xdf8(%rip),%rdi
call   10c0 <test_net2@plt>
lea    0xdf4(%rip),%rdi
call   10c0 <test_net2@plt>
lea    0xdf1(%rip),%rdi
call   10c0 <test_net2@plt>
mov    $0x7f000000,%edi
call   1060 <test_net3@plt>
mov    $0xa8138df,%edi
call   1060 <test_net3@plt>
mov    $0x0,%al
call   10e0 <test_proto@plt>
lea    0xdcf(%rip),%rdi
call   1030 <test_proto2@plt>
lea    0xdc7(%rip),%rdi
call   1030 <test_proto2@plt>
mov    $0x88,%edi
call   1090 <test_proto3@plt>
mov    $0xe0,%edi
call   1090 <test_proto3@plt>
mov    $0x0,%al
call   10b0 <test_serv@plt>
lea    0xda4(%rip),%rdi
call   1040 <test_serv2@plt>
lea    0xd9d(%rip),%rdi
call   1040 <test_serv2@plt>
mov    $0x50,%edi
call   1080 <test_serv3@plt>
mov    $0x1f90,%edi
call   1080 <test_serv3@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   10d0 <test_host@plt>
lea    0xe2d(%rip),%rdi
call   10a0 <test_host2@plt>
lea    0xe2b(%rip),%rdi
call   10a0 <test_host2@plt>
lea    0xe2d(%rip),%rdi
call   10a0 <test_host2@plt>
movl   $0x100007f,0x8(%rsp)
01
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <test_host3@plt>
movl   $0xdf38810a,0x8(%rsp)
df
mov    %rbx,%rdi
call   1050 <test_host3@plt>
xor    %eax,%eax
call   1070 <test_net@plt>
lea    0xe04(%rip),%rdi
call   10c0 <test_net2@plt>
lea    0xe00(%rip),%rdi
call   10c0 <test_net2@plt>
lea    0xdfd(%rip),%rdi
call   10c0 <test_net2@plt>
mov    $0x7f000000,%edi
call   1060 <test_net3@plt>
mov    $0xa8138df,%edi
call   1060 <test_net3@plt>
xor    %eax,%eax
call   10e0 <test_proto@plt>
lea    0xddb(%rip),%rdi
call   1030 <test_proto2@plt>
lea    0xdd3(%rip),%rdi
call   1030 <test_proto2@plt>
mov    $0x88,%edi
call   1090 <test_proto3@plt>
mov    $0xe0,%edi
call   1090 <test_proto3@plt>
xor    %eax,%eax
call   10b0 <test_serv@plt>
lea    0xdb0(%rip),%rdi
call   1040 <test_serv2@plt>
lea    0xda9(%rip),%rdi
call   1040 <test_serv2@plt>
mov    $0x50,%edi
call   1080 <test_serv3@plt>
mov    $0x1f90,%edi
call   1080 <test_serv3@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@.str = [10 x i8] c"localhost\00"
@.str.1 = [14 x i8] c"www.baidu.com\00"
@.str.2 = [15 x i8] c"gux.glodon.com\00"
@.str.3 = [8 x i8] c"default\00"
@.str.4 = [9 x i8] c"loopback\00"
@.str.5 = [5 x i8] c"eth0\00"
@.str.6 = [4 x i8] c"tcp\00"
@.str.7 = [4 x i8] c"raw\00"
@.str.8 = [5 x i8] c"http\00"
@.str.9 = [5 x i8] c"abcd\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.in_addr
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @test_host()
%8 = call i32 @test_host2(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @test_host2(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @test_host2(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %6, i32 0, i32 0
store i32 16777343, i32* %11
%12 = call i32 @test_host3(%struct.in_addr* %6)
%13 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %6, i32 0, i32 0
store i32 -549945078, i32* %13
%14 = call i32 @test_host3(%struct.in_addr* %6)
%15 = call i32 (...) @test_net()
%16 = call i32 @test_net2(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @test_net2(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @test_net2(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @test_net3(i32 2130706432)
%20 = call i32 @test_net3(i32 176240863)
%21 = call i32 (...) @test_proto()
%22 = call i32 @test_proto2(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 @test_proto2(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%24 = call i32 @test_proto3(i32 136)
%25 = call i32 @test_proto3(i32 224)
%26 = call i32 (...) @test_serv()
%27 = call i32 @test_serv2(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%28 = call i32 @test_serv2(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%29 = call i32 @test_serv3(i32 80)
%30 = call i32 @test_serv3(i32 8080)
ret i32 0
}

LLVM IR (-O2):
%struct.in_addr = type { i32 }
@.str = [10 x i8] c"localhost\00"
@.str.1 = [14 x i8] c"www.baidu.com\00"
@.str.2 = [15 x i8] c"gux.glodon.com\00"
@.str.3 = [8 x i8] c"default\00"
@.str.4 = [9 x i8] c"loopback\00"
@.str.5 = [5 x i8] c"eth0\00"
@.str.6 = [4 x i8] c"tcp\00"
@.str.7 = [4 x i8] c"raw\00"
@.str.8 = [5 x i8] c"http\00"
@.str.9 = [5 x i8] c"abcd\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.in_addr
%4 = tail call i32 (...) @test_host()
%5 = tail call i32 @test_host2(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @test_host2(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @test_host2(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%8 = bitcast %struct.in_addr* %3 to i8*
%9 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i64 0, i32 0
store i32 16777343, i32* %9
%10 = call i32 @test_host3(%struct.in_addr* %3)
store i32 -549945078, i32* %9
%11 = call i32 @test_host3(%struct.in_addr* %3)
%12 = call i32 (...) @test_net()
%13 = call i32 @test_net2(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @test_net2(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @test_net2(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @test_net3(i32 2130706432)
%17 = call i32 @test_net3(i32 176240863)
%18 = call i32 (...) @test_proto()
%19 = call i32 @test_proto2(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 @test_proto2(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%21 = call i32 @test_proto3(i32 136)
%22 = call i32 @test_proto3(i32 224)
%23 = call i32 (...) @test_serv()
%24 = call i32 @test_serv2(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%25 = call i32 @test_serv2(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%26 = call i32 @test_serv3(i32 80)
%27 = call i32 @test_serv3(i32 8080)
ret i32 0
}