#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*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ ipv6_cidr2mask_host(int /*<<< orphan*/,
                                       int /*<<< orphan*/ *);
void ipv6_cidr2mask_net(uint8_t cidr, uint32_t *res) {
  int i;
  ipv6_cidr2mask_host(cidr, res);
  for (i = 0; i < 4; i++)
    res[i] = htonl(res[i]);
}


x86 assembly (clang, -O0):
<ipv6_cidr2mask_net>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <ipv6_cidr2mask_host@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1177 <ipv6_cidr2mask_net+0x57>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <htonl@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    1142 <ipv6_cidr2mask_net+0x22>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipv6_cidr2mask_net>:
push   %rbx
mov    %rsi,%rbx
call   1040 <ipv6_cidr2mask_host@plt>
mov    (%rbx),%edi
call   1030 <htonl@plt>
mov    %eax,(%rbx)
mov    0x4(%rbx),%edi
call   1030 <htonl@plt>
mov    %eax,0x4(%rbx)
mov    0x8(%rbx),%edi
call   1030 <htonl@plt>
mov    %eax,0x8(%rbx)
mov    0xc(%rbx),%edi
call   1030 <htonl@plt>
mov    %eax,0xc(%rbx)
pop    %rbx
ret

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

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