#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*/ exit(int /*<<< orphan*/);
int gcd(int, int);
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *, int *);
int test_gcd(void) {
  int s, val1, val2;
  printf("\nGreatest Common Demoninator:\nPlease input two integers\n\n");
  s = scanf("%d %d", &val1, &val2);
  if (s != 2) {
    printf("\nInput Error, Try again\n\n");
    exit(0);
  }
  return gcd(val1, val2);
}


x86 assembly (clang, -O0):
<test_gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     1188 <test_gcd+0x48>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <gcd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_gcd>:
push   %rax
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    1174 <test_gcd+0x34>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1050 <gcd@plt>
pop    %rcx
ret
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [58 x i8] c"\0AGreatest Common Demoninator:\0APlease input two integers\0A\0A\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [26 x i8] c"\0AInput Error, Try again\0A\0A\00"
define i32 @test_gcd() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %0
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = call i32 @gcd(i32 %12, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d %d\00"
@str = [57 x i8] c"\0AGreatest Common Demoninator:\0APlease input two integers\0A\00"
@str.3 = [25 x i8] c"\0AInput Error, Try again\0A\00"
define i32 @test_gcd() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = icmp eq i32 %6, 2
br i1 %7, label %11, label %8
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.3, i64 0, i64 0))
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %0
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = call i32 @gcd(i32 %12, i32 %13)
ret i32 %14
}