#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 argc, char const *argv[]) {
  int n, m;
  int r;
  scanf("%d,%d", &n, &m);
  n > m ? r = n, n = m, m = r : 1;
  while (n % m) {
    r = m % n;
    m = n;
    n = r;
  }
  printf("%d", m);
  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)
lea    0xec3(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    116d <main+0x4d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1172 <main+0x52>
jmp    1172 <main+0x52>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
cmp    $0x0,%edx
je     119d <main+0x7d>
mov    -0x18(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1172 <main+0x52>
mov    -0x18(%rbp),%esi
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%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    0x4(%rsp),%eax
mov    (%rsp),%ecx
cmp    %ecx,%eax
jle    114b <main+0x2b>
mov    %ecx,0x4(%rsp)
mov    %eax,(%rsp)
mov    %eax,%esi
jmp    114f <main+0x2f>
mov    %ecx,%esi
mov    %eax,%ecx
mov    %ecx,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1178 <main+0x58>
nopl   0x0(%rax,%rax,1)
mov    %esi,%eax
mov    %ecx,%esi
cltd
idiv   %ecx
mov    %edx,%ecx
test   %edx,%edx
jne    1160 <main+0x40>
mov    %esi,(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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