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

/* Variables and functions */
long inet_addr(char *);
char *inet_ntoa(struct in_addr);
int /*<<< orphan*/ memcpy(struct in_addr *, long *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  struct in_addr addr1, addr2;
  long l1, l2;
  l1 = inet_addr("192.168.0.74");
  l2 = inet_addr("211.100.21.179");
  printf("l1 is %ld\n", l1);
  printf("l2 is %ld\n", l2);
  memcpy(&addr1, &l1, 4);
  memcpy(&addr2, &l2, 4);
  printf("%s : %s\n", inet_ntoa(addr1), inet_ntoa(addr2));
  printf("%s\n", inet_ntoa(addr1));
  printf("%s\n", inet_ntoa(addr2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1050 <inet_addr@plt>
mov    %rax,-0x18(%rbp)
lea    0xea7(%rip),%rdi
call   1050 <inet_addr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1060 <memcpy@plt>
lea    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x4,%edx
call   1060 <memcpy@plt>
mov    -0x8(%rbp),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <inet_ntoa@plt>
mov    -0x28(%rbp),%rsi
mov    %rax,%rdx
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xea2(%rip),%rdi
call   1060 <inet_addr@plt>
mov    %rax,%rbx
mov    %rax,0x20(%rsp)
lea    0xe9b(%rip),%rdi
call   1060 <inet_addr@plt>
mov    %rax,%r14
mov    %rax,0x18(%rsp)
lea    0xe96(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe90(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%rdi
lea    0x20(%rsp),%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
lea    0x8(%rsp),%rdi
lea    0x18(%rsp),%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
mov    0x10(%rsp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%edi
call   1040 <inet_ntoa@plt>
lea    0xe4d(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@.str = [13 x i8] c"192.168.0.74\00"
@.str.1 = [15 x i8] c"211.100.21.179\00"
@.str.2 = [11 x i8] c"l1 is %ld\0A\00"
@.str.3 = [11 x i8] c"l2 is %ld\0A\00"
@.str.4 = [9 x i8] c"%s : %s\0A\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.in_addr
%3 = alloca %struct.in_addr
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
%6 = call i64 @inet_addr(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i64 %6, i64* %4
%7 = call i64 @inet_addr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i64 %7, i64* %5
%8 = load i64, i64* %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 %8)
%10 = load i64, i64* %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i64 %10)
%12 = call i32 @memcpy(%struct.in_addr* %2, i64* %4, i32 4)
%13 = call i32 @memcpy(%struct.in_addr* %3, i64* %5, i32 4)
%14 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %2, i32 0, i32 0
%15 = load i32, i32* %14
%16 = call i8* @inet_ntoa(i32 %15)
%17 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
%18 = load i32, i32* %17
%19 = call i8* @inet_ntoa(i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %16, i8* %19)
%21 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %2, i32 0, i32 0
%22 = load i32, i32* %21
%23 = call i8* @inet_ntoa(i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
%26 = load i32, i32* %25
%27 = call i8* @inet_ntoa(i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %27)
ret i32 0
}

LLVM IR (-O2):
%struct.in_addr = type { i32 }
@.str = [13 x i8] c"192.168.0.74\00"
@.str.1 = [15 x i8] c"211.100.21.179\00"
@.str.2 = [11 x i8] c"l1 is %ld\0A\00"
@.str.3 = [11 x i8] c"l2 is %ld\0A\00"
@.str.4 = [9 x i8] c"%s : %s\0A\00"
define i32 @main() {
%1 = alloca %struct.in_addr
%2 = alloca %struct.in_addr
%3 = alloca i64
%4 = alloca i64
%5 = bitcast %struct.in_addr* %1 to i8*
%6 = bitcast %struct.in_addr* %2 to i8*
%7 = bitcast i64* %3 to i8*
%8 = bitcast i64* %4 to i8*
%9 = tail call i64 @inet_addr(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i64 %9, i64* %3
%10 = tail call i64 @inet_addr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i64 %10, i64* %4
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 %9)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i64 %10)
%13 = call i32 @memcpy(%struct.in_addr* %1, i64* %3, i32 4)
%14 = call i32 @memcpy(%struct.in_addr* %2, i64* %4, i32 4)
%15 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %1, i64 0, i32 0
%16 = load i32, i32* %15
%17 = call i8* @inet_ntoa(i32 %16)
%18 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %2, i64 0, i32 0
%19 = load i32, i32* %18
%20 = call i8* @inet_ntoa(i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %17, i8* %20)
%22 = load i32, i32* %15
%23 = call i8* @inet_ntoa(i32 %22)
%24 = call i32 @puts(i8* dereferenceable(1) %23)
%25 = load i32, i32* %18
%26 = call i8* @inet_ntoa(i32 %25)
%27 = call i32 @puts(i8* dereferenceable(1) %26)
ret i32 0
}