#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 */
int /*<<< orphan*/ freenum(unsigned int *);
unsigned int gcd(unsigned int, unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int, unsigned int);
unsigned int *readnum();
int /*<<< orphan*/ srand(int);
int main(void) {
  unsigned int *a;
  unsigned int *b;
  unsigned int res = 0;
  srand(1);
  a = readnum();
  b = readnum();
  res = gcd(*a, *b);
  printf("gcd(%d, %d) = %d\n", *a, *b, res);
  freenum(a);
  freenum(b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x1,%edi
call   1050 <srand@plt>
mov    $0x0,%al
call   1030 <readnum@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <readnum@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
call   1060 <gcd@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <freenum@plt>
mov    -0x18(%rbp),%rdi
call   1070 <freenum@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1030 <readnum@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1030 <readnum@plt>
mov    %rax,%rbx
mov    (%r14),%edi
mov    (%rax),%esi
call   1060 <gcd@plt>
mov    (%r14),%esi
mov    (%rbx),%edx
lea    0xe78(%rip),%rdi
mov    %eax,%ecx
call   1040 <printf@plt>
mov    %r14,%rdi
call   1070 <freenum@plt>
mov    %rbx,%rdi
call   1070 <freenum@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"gcd(%d, %d) = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%5 = call i32 @srand(i32 1)
%6 = call i32* (...) @readnum()
store i32* %6, i32** %2
%7 = call i32* (...) @readnum()
store i32* %7, i32** %3
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
%11 = load i32, i32* %10
%12 = call i32 @gcd(i32 %9, i32 %11)
store i32 %12, i32* %4
%13 = load i32*, i32** %2
%14 = load i32, i32* %13
%15 = load i32*, i32** %3
%16 = load i32, i32* %15
%17 = load i32, i32* %4
%18 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16, i32 %17)
%19 = load i32*, i32** %2
%20 = call i32 @freenum(i32* %19)
%21 = load i32*, i32** %3
%22 = call i32 @freenum(i32* %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"gcd(%d, %d) = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @srand(i32 1)
%2 = tail call i32* (...) @readnum()
%3 = tail call i32* (...) @readnum()
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = tail call i32 @gcd(i32 %4, i32 %5)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %6)
%10 = tail call i32 @freenum(i32* %2)
%11 = tail call i32 @freenum(i32* %3)
ret i32 0
}