#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*/ uint32_t;
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ mpz_add_ui(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/);
int /*<<< orphan*/ mpz_mul_2exp(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_set_ui(int /*<<< orphan*/, int /*<<< orphan*/);
void mpz_set_uint128(mpz_t z, uint32_t a[4]) {
  mpz_set_ui(z, a[3]);
  mpz_mul_2exp(z, z, 32);
  mpz_add_ui(z, z, a[2]);
  mpz_mul_2exp(z, z, 32);
  mpz_add_ui(z, z, a[1]);
  mpz_mul_2exp(z, z, 32);
  mpz_add_ui(z, z, a[0]);
}


x86 assembly (clang, -O0):
<mpz_set_uint128>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%esi
call   1050 <mpz_set_ui@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    $0x20,%edx
call   1040 <mpz_mul_2exp@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%edx
call   1030 <mpz_add_ui@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    $0x20,%edx
call   1040 <mpz_mul_2exp@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edx
call   1030 <mpz_add_ui@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    $0x20,%edx
call   1040 <mpz_mul_2exp@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
call   1030 <mpz_add_ui@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpz_set_uint128>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
mov    0xc(%rsi),%esi
call   1050 <mpz_set_ui@plt>
mov    %ebx,%edi
mov    %ebx,%esi
mov    $0x20,%edx
call   1040 <mpz_mul_2exp@plt>
mov    0x8(%r14),%edx
mov    %ebx,%edi
mov    %ebx,%esi
call   1030 <mpz_add_ui@plt>
mov    %ebx,%edi
mov    %ebx,%esi
mov    $0x20,%edx
call   1040 <mpz_mul_2exp@plt>
mov    0x4(%r14),%edx
mov    %ebx,%edi
mov    %ebx,%esi
call   1030 <mpz_add_ui@plt>
mov    %ebx,%edi
mov    %ebx,%esi
mov    $0x20,%edx
call   1040 <mpz_mul_2exp@plt>
mov    (%r14),%edx
mov    %ebx,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <mpz_add_ui@plt>

LLVM IR (-O0):
define void @mpz_set_uint128(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
%6 = load i32*, i32** %4
%7 = getelementptr inbounds i32, i32* %6, i64 3
%8 = load i32, i32* %7
%9 = call i32 @mpz_set_ui(i32 %5, i32 %8)
%10 = load i32, i32* %3
%11 = load i32, i32* %3
%12 = call i32 @mpz_mul_2exp(i32 %10, i32 %11, i32 32)
%13 = load i32, i32* %3
%14 = load i32, i32* %3
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 2
%17 = load i32, i32* %16
%18 = call i32 @mpz_add_ui(i32 %13, i32 %14, i32 %17)
%19 = load i32, i32* %3
%20 = load i32, i32* %3
%21 = call i32 @mpz_mul_2exp(i32 %19, i32 %20, i32 32)
%22 = load i32, i32* %3
%23 = load i32, i32* %3
%24 = load i32*, i32** %4
%25 = getelementptr inbounds i32, i32* %24, i64 1
%26 = load i32, i32* %25
%27 = call i32 @mpz_add_ui(i32 %22, i32 %23, i32 %26)
%28 = load i32, i32* %3
%29 = load i32, i32* %3
%30 = call i32 @mpz_mul_2exp(i32 %28, i32 %29, i32 32)
%31 = load i32, i32* %3
%32 = load i32, i32* %3
%33 = load i32*, i32** %4
%34 = getelementptr inbounds i32, i32* %33, i64 0
%35 = load i32, i32* %34
%36 = call i32 @mpz_add_ui(i32 %31, i32 %32, i32 %35)
ret void
}

LLVM IR (-O2):
define void @mpz_set_uint128(i32 %0, i32* nocapture %1) {
%3 = getelementptr inbounds i32, i32* %1, i64 3
%4 = load i32, i32* %3
%5 = tail call i32 @mpz_set_ui(i32 %0, i32 %4)
%6 = tail call i32 @mpz_mul_2exp(i32 %0, i32 %0, i32 32)
%7 = getelementptr inbounds i32, i32* %1, i64 2
%8 = load i32, i32* %7
%9 = tail call i32 @mpz_add_ui(i32 %0, i32 %0, i32 %8)
%10 = tail call i32 @mpz_mul_2exp(i32 %0, i32 %0, i32 32)
%11 = getelementptr inbounds i32, i32* %1, i64 1
%12 = load i32, i32* %11
%13 = tail call i32 @mpz_add_ui(i32 %0, i32 %0, i32 %12)
%14 = tail call i32 @mpz_mul_2exp(i32 %0, i32 %0, i32 32)
%15 = load i32, i32* %1
%16 = tail call i32 @mpz_add_ui(i32 %0, i32 %0, i32 %15)
ret void
}