#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 */
int /*<<< orphan*/ adjust_bufsize(int /*<<< orphan*/ **, size_t *, size_t,
                                  size_t, int);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
void adjust_mpz_bufsize(mpz_t **x, size_t *alloc_ptr, size_t size,
                        size_t increment) {
  size_t old_alloc;
  old_alloc = *alloc_ptr;
  adjust_bufsize(x, alloc_ptr, size, increment, sizeof(**x));
  while (old_alloc < *alloc_ptr)
    mpz_init((*x)[old_alloc++]);
}


x86 assembly (clang, -O0):
<adjust_mpz_bufsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x4,%r8d
call   1040 <adjust_bufsize@plt>
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
jae    1192 <adjust_mpz_bufsize+0x72>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x28(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    (%rax,%rcx,4),%edi
call   1030 <mpz_init@plt>
jmp    115e <adjust_mpz_bufsize+0x3e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adjust_mpz_bufsize>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    (%rsi),%rbx
mov    $0x4,%r8d
call   1040 <adjust_bufsize@plt>
cmp    (%r15),%rbx
jae    1154 <adjust_mpz_bufsize+0x34>
xchg   %ax,%ax
mov    (%r14),%rax
mov    (%rax,%rbx,4),%edi
add    $0x1,%rbx
call   1030 <mpz_init@plt>
cmp    (%r15),%rbx
jb     1140 <adjust_mpz_bufsize+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @adjust_mpz_bufsize(i32** %0, i64* %1, i64 %2, i64 %3) {
%5 = load i64, i64* %1
%6 = tail call i32 @adjust_bufsize(i32** %0, i64* %1, i64 %2, i64 %3, i32 4)
%7 = load i64, i64* %1
%8 = icmp ult i64 %5, %7
br i1 %8, label %9, label %18
9: ; preds = %4, %9
%10 = phi i64 [ %12, %9 ], [ %5, %4 ]
%11 = load i32*, i32** %0
%12 = add nuw i64 %10, 1
%13 = getelementptr inbounds i32, i32* %11, i64 %10
%14 = load i32, i32* %13
%15 = tail call i32 @mpz_init(i32 %14)
%16 = load i64, i64* %1
%17 = icmp ult i64 %12, %16
br i1 %17, label %9, label %18
18: ; preds = %9, %4
ret void
}