#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int x, y;
  printf("GCD of two numbers\nEnter x and y :: ");
  scanf("%d%d", &x, &y);
  if (x == 0 && y == 0) {
    printf("Error: Atleast one of the integer must not be zero.");
  } else {
    if (x < y) {
      printf("\n GCD:: %d", gcd(x, y));
    } else {
      printf("\n GCD:: %d", gcd(y, x));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1188 <main+0x58>
cmpl   $0x0,-0xc(%rbp)
jne    1188 <main+0x58>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d4 <main+0xa4>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b4 <main+0x84>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <gcd@plt>
mov    %eax,%esi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11cf <main+0x9f>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <gcd@plt>
mov    %eax,%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d4 <main+0xa4>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%eax
mov    %esi,%ecx
or     %eax,%ecx
jne    1170 <main+0x40>
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1191 <main+0x61>
cmp    %eax,%esi
jge    117a <main+0x4a>
mov    %esi,%edi
mov    %eax,%esi
jmp    117c <main+0x4c>
mov    %eax,%edi
call   1050 <gcd@plt>
lea    0xed6(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"GCD of two numbers\0AEnter x and y :: \00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [52 x i8] c"Error: Atleast one of the integer must not be zero.\00"
@.str.3 = [11 x i8] c"\0A GCD:: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
br label %28
13: ; preds = %8, %0
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 @gcd(i32 %18, i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %20)
br label %27
22: ; preds = %13
%23 = load i32, i32* %3
%24 = load i32, i32* %2
%25 = call i32 @gcd(i32 %23, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %22, %17
br label %28
28: ; preds = %27, %11
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"GCD of two numbers\0AEnter x and y :: \00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [52 x i8] c"Error: Atleast one of the integer must not be zero.\00"
@.str.3 = [11 x i8] c"\0A GCD:: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 0
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
%11 = select i1 %8, i1 %10, i1 false
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
br label %22
14: ; preds = %0
%15 = icmp slt i32 %7, %9
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = call i32 @gcd(i32 %7, i32 %9)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %22
19: ; preds = %14
%20 = call i32 @gcd(i32 %9, i32 %7)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %16, %19, %12
ret i32 0
}