#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 */
long gcd(long, long);
int /*<<< orphan*/ printf(char *, long);
int scanf(char *, long *, long *);
int main() {
  long a, b, GCD;
  int K = scanf("%ld %ld", &a, &b);
  if (K != 2)
    return 1;
  GCD = gcd((((a) > (b)) ? (a) : (b)), (((a) < (b)) ? (a) : (b)));
  printf("%ld\n", GCD);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <scanf@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
je     116c <main+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    11e2 <main+0xb2>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    1187 <main+0x57>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    118f <main+0x5f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    11b2 <main+0x82>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    11ba <main+0x8a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1050 <gcd@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x2,%ecx
jne    1184 <main+0x54>
mov    0x10(%rsp),%rax
mov    0x8(%rsp),%rsi
cmp    %rsi,%rax
mov    %rsi,%rdi
cmovg  %rax,%rdi
cmovl  %rax,%rsi
call   1050 <gcd@plt>
lea    0xe8e(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%ld %ld\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %2, i64* %3)
store i32 %6, i32* %5
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %0
store i32 1, i32* %1
br label %32
10: ; preds = %0
%11 = load i64, i64* %2
%12 = load i64, i64* %3
%13 = icmp sgt i64 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i64, i64* %2
br label %18
16: ; preds = %10
%17 = load i64, i64* %3
br label %18
18: ; preds = %16, %14
%19 = phi i64 [ %15, %14 ], [ %17, %16 ]
%20 = load i64, i64* %2
%21 = load i64, i64* %3
%22 = icmp slt i64 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = load i64, i64* %2
br label %27
25: ; preds = %18
%26 = load i64, i64* %3
br label %27
27: ; preds = %25, %23
%28 = phi i64 [ %24, %23 ], [ %26, %25 ]
%29 = call i64 @gcd(i64 %19, i64 %28)
store i64 %29, i64* %4
%30 = load i64, i64* %4
%31 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %30)
store i32 0, i32* %1
br label %32
32: ; preds = %27, %9
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str = [8 x i8] c"%ld %ld\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %16
7: ; preds = %0
%8 = load i64, i64* %1
%9 = load i64, i64* %2
%10 = icmp sgt i64 %8, %9
%11 = select i1 %10, i64 %8, i64 %9
%12 = icmp slt i64 %8, %9
%13 = select i1 %12, i64 %8, i64 %9
%14 = call i64 @gcd(i64 %11, i64 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %14)
br label %16
16: ; preds = %0, %7
%17 = phi i32 [ 0, %7 ], [ 1, %0 ]
ret i32 %17
}