#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*/ get_eth_ip(char const *, char *);
int /*<<< orphan*/ get_ip_by_domain(char const *, char *);
int /*<<< orphan*/ get_local_ip(char *);
int /*<<< orphan*/ get_local_mac(char const *, char *);
int /*<<< orphan*/ printf(char *, char const *, ...);
int main(void) {
  char ip[16];
  char mac[18];
  const char *test_domain = "www.baidu.com";
  const char *test_eth = "eth0";
  char local_ip[16];
  get_ip_by_domain(test_domain, ip);
  printf("%s ip: %s\n", test_domain, ip);
  get_local_mac(test_eth, mac);
  printf("local %s mac: %s\n", test_eth, mac);
  get_eth_ip(test_eth, ip);
  printf("local %s ip: %s\n", test_eth, ip);
  get_local_ip(local_ip);
  printf("local ip: %s\n", local_ip);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xe9d(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <get_ip_by_domain@plt>
mov    -0x48(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x50(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <get_local_mac@plt>
mov    -0x50(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x50(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <get_eth_ip@plt>
mov    -0x50(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1070 <get_local_ip@plt>
lea    -0x60(%rbp),%rsi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xea0(%rip),%rbx
lea    0x10(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <get_ip_by_domain@plt>
lea    0xeb4(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe83(%rip),%rbx
lea    0x20(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <get_local_mac@plt>
lea    0xe71(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <get_eth_ip@plt>
lea    0xe64(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1070 <get_local_ip@plt>
lea    0xe56(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"www.baidu.com\00"
@.str.1 = [5 x i8] c"eth0\00"
@.str.2 = [11 x i8] c"%s ip: %s\0A\00"
@.str.3 = [18 x i8] c"local %s mac: %s\0A\00"
@.str.4 = [17 x i8] c"local %s ip: %s\0A\00"
@.str.5 = [14 x i8] c"local ip: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
%3 = alloca [18 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [16 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %5
%7 = load i8*, i8** %4
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%9 = call i32 @get_ip_by_domain(i8* %7, i8* %8)
%10 = load i8*, i8** %4
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%12 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %10, i8* %11)
%13 = load i8*, i8** %5
%14 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%15 = call i32 @get_local_mac(i8* %13, i8* %14)
%16 = load i8*, i8** %5
%17 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%18 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %16, i8* %17)
%19 = load i8*, i8** %5
%20 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%21 = call i32 @get_eth_ip(i8* %19, i8* %20)
%22 = load i8*, i8** %5
%23 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%24 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %22, i8* %23)
%25 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%26 = call i32 @get_local_ip(i8* %25)
%27 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%28 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"www.baidu.com\00"
@.str.1 = [5 x i8] c"eth0\00"
@.str.2 = [11 x i8] c"%s ip: %s\0A\00"
@.str.3 = [18 x i8] c"local %s mac: %s\0A\00"
@.str.4 = [17 x i8] c"local %s ip: %s\0A\00"
@.str.5 = [14 x i8] c"local ip: %s\0A\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = alloca [18 x i8]
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%7 = call i32 @get_ip_by_domain(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %4)
%8 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %4)
%9 = call i32 @get_local_mac(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%10 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%11 = call i32 @get_eth_ip(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%12 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%13 = call i32 @get_local_ip(i8* %6)
%14 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %6)
ret i32 0
}