#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 vectorCopy(mpfr_t *result, mpfr_t *vector, const size_t size) {
  int err = 0;
  for (size_t i = 0; i < size; ++i) {
    err += mpfr_set(result[i], vector[i], mpfr_get_default_rounding_mode());
  }
  return err;
}


x86 assembly (clang, -O0):
<vectorCopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    119f <vectorCopy+0x7f>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   1030 <mpfr_get_default_rounding_mode@plt>
mov    -0x30(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    %eax,%edx
call   1040 <mpfr_set@plt>
mov    %rax,%rcx
movslq -0x1c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1143 <vectorCopy+0x23>
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vectorCopy>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
je     116e <vectorCopy+0x4e>
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r12
xor    %r14d,%r14d
xor    %ebp,%ebp
xchg   %ax,%ax
mov    (%r12,%r14,4),%eax
mov    %eax,0x4(%rsp)
mov    (%r15,%r14,4),%r13d
xor    %eax,%eax
call   1030 <mpfr_get_default_rounding_mode@plt>
mov    0x4(%rsp),%edi
mov    %r13d,%esi
mov    %eax,%edx
call   1040 <mpfr_set@plt>
add    %eax,%ebp
add    $0x1,%r14
cmp    %r14,%rbx
jne    1140 <vectorCopy+0x20>
jmp    1170 <vectorCopy+0x50>
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 @vectorCopy(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
store i32 0, i32* %7
store i64 0, i64* %8
br label %9
9: ; preds = %28, %3
%10 = load i64, i64* %8
%11 = load i64, i64* %6
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %31
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** %5
%19 = load i64, i64* %8
%20 = getelementptr inbounds i32, i32* %18, i64 %19
%21 = load i32, i32* %20
%22 = call i32 (...) @mpfr_get_default_rounding_mode()
%23 = call i64 @mpfr_set(i32 %17, i32 %21, i32 %22)
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = add nsw i64 %25, %23
%27 = trunc i64 %26 to i32
store i32 %27, i32* %7
br label %28
28: ; preds = %13
%29 = load i64, i64* %8
%30 = add i64 %29, 1
store i64 %30, i64* %8
br label %9
31: ; preds = %9
%32 = load i32, i32* %7
ret i32 %32
}

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