#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;

/* Variables and functions */
int /*<<< orphan*/ mpfr_get_default_rounding_mode();
scalar_t__ mpfr_set(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int fillArrayWith(mpfr_t *array, const size_t size, mpfr_t fillWith) {
  int err = 0;
  for (size_t i = 0; i < size; ++i) {
    err += mpfr_set(array[i], fillWith, mpfr_get_default_rounding_mode());
  }
  return err;
}


x86 assembly (clang, -O0):
<fillArrayWith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1196 <fillArrayWith+0x76>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1030 <mpfr_get_default_rounding_mode@plt>
mov    -0x28(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    %eax,%edx
call   1040 <mpfr_set@plt>
mov    %rax,%rcx
movslq -0x18(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1142 <fillArrayWith+0x22>
mov    -0x18(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillArrayWith>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1165 <fillArrayWith+0x45>
mov    %edx,%r14d
mov    %rsi,%r12
mov    %rdi,%r15
xor    %ebx,%ebx
xor    %ebp,%ebp
nopl   (%rax)
mov    (%r15,%rbx,4),%r13d
xor    %eax,%eax
call   1030 <mpfr_get_default_rounding_mode@plt>
mov    %r13d,%edi
mov    %r14d,%esi
mov    %eax,%edx
call   1040 <mpfr_set@plt>
add    %eax,%ebp
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <fillArrayWith+0x20>
jmp    1167 <fillArrayWith+0x47>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fillArrayWith(i32* nocapture %0, i64 %1, i32 %2) {
%4 = icmp eq i64 %1, 0
br i1 %4, label %5, label %7
5: ; preds = %7, %3
%6 = phi i32 [ 0, %3 ], [ %15, %7 ]
ret i32 %6
7: ; preds = %3, %7
%8 = phi i64 [ %16, %7 ], [ 0, %3 ]
%9 = phi i32 [ %15, %7 ], [ 0, %3 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %8
%11 = load i32, i32* %10
%12 = tail call i32 (...) @mpfr_get_default_rounding_mode()
%13 = tail call i64 @mpfr_set(i32 %11, i32 %2, i32 %12)
%14 = trunc i64 %13 to i32
%15 = add i32 %9, %14
%16 = add nuw i64 %8, 1
%17 = icmp eq i64 %16, %1
br i1 %17, label %5, label %7
}