#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*/ mpfr_t;
typedef int /*<<< orphan*/ mpfr_prec_t;

/* Variables and functions */
int /*<<< orphan*/ m_init2(int /*<<< orphan*/, int /*<<< orphan*/);
void arr_fill_2d(const size_t x, const size_t y, mpfr_t array[x][y],
                 mpfr_prec_t precision) {
  for (size_t i = 0; i < x; i++) {
    for (size_t j = 0; j < y; j++) {
      m_init2(array[i][j], precision);
    }
  }
}


x86 assembly (clang, -O0):
<arr_fill_2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    11a5 <arr_fill_2d+0x95>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    118f <arr_fill_2d+0x7f>
mov    -0x38(%rbp),%rcx
mov    -0x18(%rbp),%rax
imul   -0x28(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x1c(%rbp),%esi
call   1030 <m_init2@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    114d <arr_fill_2d+0x3d>
jmp    1194 <arr_fill_2d+0x84>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1137 <arr_fill_2d+0x27>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arr_fill_2d>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,(%rsp)
test   %rdi,%rdi
je     1177 <arr_fill_2d+0x67>
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rsi,%rbp
lea    0x0(,%rsi,4),%r12
xor    %r13d,%r13d
jmp    114d <arr_fill_2d+0x3d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r13
add    %r12,%rbx
cmp    (%rsp),%r13
je     1177 <arr_fill_2d+0x67>
test   %rbp,%rbp
je     1140 <arr_fill_2d+0x30>
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rbx,%r15,4),%edi
mov    %r14d,%esi
call   1030 <m_init2@plt>
add    $0x1,%r15
cmp    %r15,%rbp
jne    1160 <arr_fill_2d+0x50>
jmp    1140 <arr_fill_2d+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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