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

/* Variables and functions */
void *vcalloc(int, int);
int **declare_int2(int f, int *s, int d) {
  int **r;
  int a;
  r = vcalloc(f, sizeof(int *));
  for (a = 0; a < f; a++)
    r[a] = vcalloc(s[a] + d, sizeof(int));
  return r;
}


x86 assembly (clang, -O0):
<declare_int2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1030 <vcalloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    117b <declare_int2+0x6b>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
add    -0x14(%rbp),%edi
mov    $0x4,%esi
call   1030 <vcalloc@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113a <declare_int2+0x2a>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<declare_int2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%r12
mov    %edi,%r15d
mov    $0x8,%esi
call   1030 <vcalloc@plt>
mov    %rax,%r13
test   %r15d,%r15d
jle    115f <declare_int2+0x4f>
mov    %r15d,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbp,4),%edi
add    %r14d,%edi
mov    $0x4,%esi
call   1030 <vcalloc@plt>
mov    %rax,0x0(%r13,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1140 <declare_int2+0x30>
mov    %r13,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32** @declare_int2(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32**
%8 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = call i8* @vcalloc(i32 %9, i32 8)
%11 = bitcast i8* %10 to i32**
store i32** %11, i32*** %7
store i32 0, i32* %8
br label %12
12: ; preds = %30, %3
%13 = load i32, i32* %8
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %33
16: ; preds = %12
%17 = load i32*, i32** %5
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = load i32, i32* %6
%23 = add nsw i32 %21, %22
%24 = call i8* @vcalloc(i32 %23, i32 4)
%25 = bitcast i8* %24 to i32*
%26 = load i32**, i32*** %7
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32*, i32** %26, i64 %28
store i32* %25, i32** %29
br label %30
30: ; preds = %16
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 1
store i32 %32, i32* %8
br label %12
33: ; preds = %12
%34 = load i32**, i32*** %7
ret i32** %34
}

LLVM IR (-O2):
define i32** @declare_int2(i32 %0, i32* nocapture %1, i32 %2) {
%4 = tail call i8* @vcalloc(i32 %0, i32 8)
%5 = bitcast i8* %4 to i32**
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %19
7: ; preds = %3
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %17, %9 ]
%11 = getelementptr inbounds i32, i32* %1, i64 %10
%12 = load i32, i32* %11
%13 = add nsw i32 %12, %2
%14 = tail call i8* @vcalloc(i32 %13, i32 4)
%15 = getelementptr inbounds i32*, i32** %5, i64 %10
%16 = bitcast i32** %15 to i8**
store i8* %14, i8** %16
%17 = add nuw nsw i64 %10, 1
%18 = icmp eq i64 %17, %8
br i1 %18, label %19, label %9
19: ; preds = %9, %3
ret i32** %5
}