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

/* Variables and functions */
int /*<<< orphan*/ mpz_add_ui(int /*<<< orphan*/, int /*<<< orphan*/,
                              unsigned int);
int /*<<< orphan*/ mpz_set_ui(int /*<<< orphan*/, unsigned int);
void sigma_one_z_nocache(mpz_t sum, unsigned int n) {
  mpz_set_ui(sum, n);
  unsigned int d;
  unsigned int ns = n / 2;
  for (d = 1; d <= ns; d++) {
    if (n % d)
      continue;
    mpz_add_ui(sum, sum, d);
  }
}


x86 assembly (clang, -O0):
<sigma_one_z_nocache>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <mpz_set_ui@plt>
mov    -0x8(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
ja     1187 <sigma_one_z_nocache+0x67>
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
cmp    $0x0,%edx
je     116b <sigma_one_z_nocache+0x4b>
jmp    1179 <sigma_one_z_nocache+0x59>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <mpz_add_ui@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1149 <sigma_one_z_nocache+0x29>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigma_one_z_nocache>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %edi,%r14d
call   1040 <mpz_set_ui@plt>
cmp    $0x2,%r15d
jae    1143 <sigma_one_z_nocache+0x23>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15d,%ebx
shr    %ebx
neg    %ebx
mov    $0x1,%ebp
jmp    1172 <sigma_one_z_nocache+0x52>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
je     1138 <sigma_one_z_nocache+0x18>
mov    %r15d,%eax
xor    %edx,%edx
div    %ebp
test   %edx,%edx
jne    1160 <sigma_one_z_nocache+0x40>
mov    %r14d,%edi
mov    %r14d,%esi
mov    %ebp,%edx
call   1030 <mpz_add_ui@plt>
jmp    1160 <sigma_one_z_nocache+0x40>

LLVM IR (-O0):
define void @sigma_one_z_nocache(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @mpz_set_ui(i32 %7, i32 %8)
%10 = load i32, i32* %4
%11 = udiv i32 %10, 2
store i32 %11, i32* %6
store i32 1, i32* %5
br label %12
12: ; preds = %27, %2
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = icmp ule i32 %13, %14
br i1 %15, label %16, label %30
16: ; preds = %12
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = urem i32 %17, %18
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %16
br label %27
22: ; preds = %16
%23 = load i32, i32* %3
%24 = load i32, i32* %3
%25 = load i32, i32* %5
%26 = call i32 @mpz_add_ui(i32 %23, i32 %24, i32 %25)
br label %27
27: ; preds = %22, %21
%28 = load i32, i32* %5
%29 = add i32 %28, 1
store i32 %29, i32* %5
br label %12
30: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @sigma_one_z_nocache(i32 %0, i32 %1) {
%3 = tail call i32 @mpz_set_ui(i32 %0, i32 %1)
%4 = icmp ult i32 %1, 2
br i1 %4, label %16, label %5
5: ; preds = %2
%6 = lshr i32 %1, 1
br label %7
7: ; preds = %5, %13
%8 = phi i32 [ %14, %13 ], [ 1, %5 ]
%9 = urem i32 %1, %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = tail call i32 @mpz_add_ui(i32 %0, i32 %0, i32 %8)
br label %13
13: ; preds = %7, %11
%14 = add nuw i32 %8, 1
%15 = icmp eq i32 %8, %6
br i1 %15, label %16, label %7
16: ; preds = %13, %2
ret void
}