#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*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ ntohl(int /*<<< orphan*/);
void ipv6_addr2addr_host(uint32_t *addr, uint32_t *res) {
  int i;
  memset(res, 0, sizeof(uint32_t) * 4);
  for (i = 0; i < 4; i++) {
    res[i] = ntohl(addr[i]);
  }
}


x86 assembly (clang, -O0):
<ipv6_addr2addr_host>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    117c <ipv6_addr2addr_host+0x5c>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <ntohl@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <ipv6_addr2addr_host+0x27>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipv6_addr2addr_host>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
mov    (%r14),%edi
call   1040 <ntohl@plt>
mov    %eax,(%rbx)
mov    0x4(%r14),%edi
call   1040 <ntohl@plt>
mov    %eax,0x4(%rbx)
mov    0x8(%r14),%edi
call   1040 <ntohl@plt>
mov    %eax,0x8(%rbx)
mov    0xc(%r14),%edi
call   1040 <ntohl@plt>
mov    %eax,0xc(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ipv6_addr2addr_host(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = call i32 @memset(i32* %6, i32 0, i32 16)
store i32 0, i32* %5
br label %8
8: ; preds = %22, %2
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %25
11: ; preds = %8
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @ntohl(i32 %16)
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
br label %22
22: ; preds = %11
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %8
25: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @ipv6_addr2addr_host(i32* nocapture %0, i32* %1) {
%3 = tail call i32 @memset(i32* %1, i32 0, i32 16)
%4 = load i32, i32* %0
%5 = tail call i32 @ntohl(i32 %4)
store i32 %5, i32* %1
%6 = getelementptr inbounds i32, i32* %0, i64 1
%7 = load i32, i32* %6
%8 = tail call i32 @ntohl(i32 %7)
%9 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %8, i32* %9
%10 = getelementptr inbounds i32, i32* %0, i64 2
%11 = load i32, i32* %10
%12 = tail call i32 @ntohl(i32 %11)
%13 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %12, i32* %13
%14 = getelementptr inbounds i32, i32* %0, i64 3
%15 = load i32, i32* %14
%16 = tail call i32 @ntohl(i32 %15)
%17 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %16, i32* %17
ret void
}