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

/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
void init_vector_mpz(mpz_t **vector, unsigned int n) {
  *vector = (mpz_t *)malloc(sizeof(mpz_t) * n);
  for (; n > 0; --n)
    mpz_init((*vector)[n - 1]);
}


x86 assembly (clang, -O0):
<init_vector_mpz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
cmpl   $0x0,-0xc(%rbp)
jbe    1176 <init_vector_mpz+0x56>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,4),%edi
call   1030 <mpz_init@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1147 <init_vector_mpz+0x27>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_vector_mpz>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r15
lea    0x0(,%r14,4),%edi
call   1040 <malloc@plt>
mov    %rax,(%r15)
test   %r14d,%r14d
je     1176 <init_vector_mpz+0x56>
mov    %r14d,%ebx
lea    -0x1(%rbx),%r14
mov    -0x4(%rax,%rbx,4),%edi
call   1030 <mpz_init@plt>
test   %r14,%r14
je     1176 <init_vector_mpz+0x56>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15),%rax
mov    -0x8(%rax,%rbx,4),%edi
call   1030 <mpz_init@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
jne    1160 <init_vector_mpz+0x40>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @init_vector_mpz(i32** %0, i32 %1) {
%3 = alloca i32**
%4 = alloca i32
store i32** %0, i32*** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = zext i32 %5 to i64
%7 = mul i64 4, %6
%8 = trunc i64 %7 to i32
%9 = call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i32*
%11 = load i32**, i32*** %3
store i32* %10, i32** %11
br label %12
12: ; preds = %24, %2
%13 = load i32, i32* %4
%14 = icmp ugt i32 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %12
%16 = load i32**, i32*** %3
%17 = load i32*, i32** %16
%18 = load i32, i32* %4
%19 = sub i32 %18, 1
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %17, i64 %20
%22 = load i32, i32* %21
%23 = call i32 @mpz_init(i32 %22)
br label %24
24: ; preds = %15
%25 = load i32, i32* %4
%26 = add i32 %25, -1
store i32 %26, i32* %4
br label %12
27: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @init_vector_mpz(i32** nocapture %0, i32 %1) {
%3 = shl i32 %1, 2
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %0
%6 = icmp eq i32 %1, 0
br i1 %6, label %22, label %7
7: ; preds = %2
%8 = zext i32 %1 to i64
%9 = add nsw i64 %8, -1
%10 = getelementptr inbounds i32, i32* %5, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 @mpz_init(i32 %11)
%13 = icmp eq i64 %9, 0
br i1 %13, label %22, label %14
14: ; preds = %7, %14
%15 = phi i64 [ %17, %14 ], [ %9, %7 ]
%16 = load i32*, i32** %0
%17 = add nsw i64 %15, -1
%18 = getelementptr inbounds i32, i32* %16, i64 %17
%19 = load i32, i32* %18
%20 = tail call i32 @mpz_init(i32 %19)
%21 = icmp eq i64 %17, 0
br i1 %21, label %22, label %14
22: ; preds = %14, %7, %2
ret void
}