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

/* Variables and functions */
unsigned long gcd(unsigned long, unsigned long);
int /*<<< orphan*/ gen_gcd(unsigned long, unsigned long, unsigned long);
int /*<<< orphan*/ limit2_u64(unsigned long *, int /*<<< orphan*/, int);
unsigned long mksym_u64();
int test_gcd() {
  unsigned long a = 0;
  unsigned long b = 0;
  unsigned long r = 0;
  a = mksym_u64();
  b = mksym_u64();
  limit2_u64(&a, 0, 8);
  limit2_u64(&b, 0, 16);
  r = gcd(a, b);
  gen_gcd(a, b, r);
  return 0;
}


x86 assembly (clang, -O0):
<test_gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <mksym_u64@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <mksym_u64@plt>
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <limit2_u64@plt>
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <limit2_u64@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <gcd@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <gen_gcd@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_gcd>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1040 <mksym_u64@plt>
mov    %rax,0x10(%rsp)
xor    %eax,%eax
call   1040 <mksym_u64@plt>
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <limit2_u64@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <limit2_u64@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1060 <gcd@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    %rax,%rdx
call   1050 <gen_gcd@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @test_gcd() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
store i64 0, i64* %1
store i64 0, i64* %2
store i64 0, i64* %3
%4 = call i64 (...) @mksym_u64()
store i64 %4, i64* %1
%5 = call i64 (...) @mksym_u64()
store i64 %5, i64* %2
%6 = call i32 @limit2_u64(i64* %1, i32 0, i32 8)
%7 = call i32 @limit2_u64(i64* %2, i32 0, i32 16)
%8 = load i64, i64* %1
%9 = load i64, i64* %2
%10 = call i64 @gcd(i64 %8, i64 %9)
store i64 %10, i64* %3
%11 = load i64, i64* %1
%12 = load i64, i64* %2
%13 = load i64, i64* %3
%14 = call i32 @gen_gcd(i64 %11, i64 %12, i64 %13)
ret i32 0
}

LLVM IR (-O2):
define i32 @test_gcd() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = tail call i64 (...) @mksym_u64()
store i64 %5, i64* %1
%6 = tail call i64 (...) @mksym_u64()
store i64 %6, i64* %2
%7 = call i32 @limit2_u64(i64* %1, i32 0, i32 8)
%8 = call i32 @limit2_u64(i64* %2, i32 0, i32 16)
%9 = load i64, i64* %1
%10 = load i64, i64* %2
%11 = call i64 @gcd(i64 %9, i64 %10)
%12 = load i64, i64* %1
%13 = load i64, i64* %2
%14 = call i32 @gen_gcd(i64 %12, i64 %13, i64 %11)
ret i32 0
}