#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 euclidean_gcd(int, int);
int euclidean_gcd_recursive(int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int first = 49;
  int second = 7;
  int answer_recursive = euclidean_gcd_recursive(first, second);
  int answer_iterative = euclidean_gcd(first, second);
  printf("GCD of %d and %d is : %d by recursive algo.\n", first, second,
         answer_recursive);
  printf("GCD of %d and %d is : %d by iterative algo.\n", first, second,
         answer_iterative);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x31,-0x8(%rbp)
movl   $0x7,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <euclidean_gcd_recursive@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <euclidean_gcd@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x31,%edi
mov    $0x7,%esi
call   1030 <euclidean_gcd_recursive@plt>
mov    %eax,%ebx
mov    $0x31,%edi
mov    $0x7,%esi
call   1050 <euclidean_gcd@plt>
mov    %eax,%ebp
lea    0xea4(%rip),%rdi
mov    $0x31,%esi
mov    $0x7,%edx
mov    %ebx,%ecx
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x31,%esi
mov    $0x7,%edx
mov    %ebp,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [45 x i8] c"GCD of %d and %d is : %d by recursive algo.\0A\00"
@.str.1 = [45 x i8] c"GCD of %d and %d is : %d by iterative algo.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 49, i32* %2
store i32 7, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @euclidean_gcd_recursive(i32 %6, i32 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = call i32 @euclidean_gcd(i32 %9, i32 %10)
store i32 %11, i32* %5
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13, i32 %14)
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = load i32, i32* %5
%19 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %17, i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"GCD of %d and %d is : %d by recursive algo.\0A\00"
@.str.1 = [45 x i8] c"GCD of %d and %d is : %d by iterative algo.\0A\00"
define i32 @main() {
%1 = tail call i32 @euclidean_gcd_recursive(i32 49, i32 7)
%2 = tail call i32 @euclidean_gcd(i32 49, i32 7)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 49, i32 7, i32 %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 49, i32 7, i32 %2)
ret i32 0
}