#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int max, min, temp;
  scanf("%d%d", &max, &min);
  if (min > max) {
    temp = min;
    min = max;
    max = temp;
  }
  while (min != 0) {
    max %= min;
    temp = min;
    min = max;
    max = temp;
  };
  printf("%d\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1161 <main+0x41>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1166 <main+0x46>
cmpl   $0x0,-0xc(%rbp)
je     1193 <main+0x73>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1166 <main+0x46>
mov    -0x8(%rbp),%esi
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%eax
mov    0x4(%rsp),%edx
cmp    %edx,%eax
jle    114f <main+0x2f>
mov    %edx,(%rsp)
mov    %eax,0x4(%rsp)
mov    %eax,%esi
test   %edx,%edx
jne    1160 <main+0x40>
jmp    1176 <main+0x56>
mov    %edx,%esi
mov    %eax,%edx
test   %edx,%edx
je     1176 <main+0x56>
nopw   0x0(%rax,%rax,1)
mov    %esi,%eax
mov    %edx,%esi
cltd
idiv   %esi
test   %edx,%edx
jne    1160 <main+0x40>
mov    %esi,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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