#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 gcd(int, int);
int gcd_mod(int, int);
int gcd_modrec(int, int);
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char **argv) {
  int a = 1071, b = 462;
  printf("a=%d, b=%d\n", a, b);
  printf("       gcd(a, b) = %d\n", gcd(a, b));
  printf("   gcd_mod(a, b) = %d\n", gcd_mod(a, b));
  printf("gcd_modrec(a, b) = %d\n", gcd_modrec(a, b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x42f,-0x14(%rbp)
movl   $0x1ce,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1060 <gcd@plt>
mov    %eax,%esi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <gcd_mod@plt>
mov    %eax,%esi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <gcd_modrec@plt>
mov    %eax,%esi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
mov    $0x42f,%esi
mov    $0x1ce,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x42f,%edi
mov    $0x1ce,%esi
call   1060 <gcd@plt>
lea    0xe9d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x42f,%edi
mov    $0x1ce,%esi
call   1040 <gcd_mod@plt>
lea    0xe95(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x42f,%edi
mov    $0x1ce,%esi
call   1050 <gcd_modrec@plt>
lea    0xe8d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"a=%d, b=%d\0A\00"
@.str.1 = [23 x i8] c" gcd(a, b) = %d\0A\00"
@.str.2 = [23 x i8] c" gcd_mod(a, b) = %d\0A\00"
@.str.3 = [23 x i8] c"gcd_modrec(a, b) = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1071, i32 462)
%4 = tail call i32 @gcd(i32 1071, i32 462)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = tail call i32 @gcd_mod(i32 1071, i32 462)
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = tail call i32 @gcd_modrec(i32 1071, i32 462)
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %8)
ret i32 0
}