#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*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int m = 0, n = 0, t = 0;
  printf("Enter the no1:\n");
  scanf("%d", &m);
  printf("Enter the no2:\n");
  scanf("%d", &n);
  if (m <= n) {
    t = m;
  } else {
    t = n;
  }
  while (m % t != 0) {
    t = t - 1;
  }
prev:
  if (n % t == 0) {
    printf("GCD of %d & %d is: %d\n", m, n, t);
    _exit(0);
  }
  t--;
  goto prev;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11a7 <main+0x77>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11ad <main+0x7d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11b2 <main+0x82>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
je     11d0 <main+0xa0>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b2 <main+0x82>
jmp    11d5 <main+0xa5>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    1203 <main+0xd3>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1030 <_exit@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    11d5 <main+0xa5>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xebe(%rip),%rdi
call   1040 <puts@plt>
lea    0xe98(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xead(%rip),%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%r8d
cmp    %r8d,%esi
mov    %esi,%ecx
cmovg  %r8d,%ecx
mov    %esi,%eax
cltd
idiv   %ecx
add    $0xffffffff,%ecx
test   %edx,%edx
jne    11a0 <main+0x60>
add    $0x2,%ecx
nop
add    $0xffffffff,%ecx
mov    %r8d,%eax
cltd
idiv   %ecx
test   %edx,%edx
jne    11b0 <main+0x70>
lea    0xe3f(%rip),%rdi
mov    %r8d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Enter the no1:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"Enter the no2:\0A\00"
@.str.3 = [23 x i8] c"GCD of %d & %d is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = load i32, i32* %2
store i32 %13, i32* %4
br label %16
14: ; preds = %0
%15 = load i32, i32* %3
store i32 %15, i32* %4
br label %16
16: ; preds = %14, %12
br label %17
17: ; preds = %22, %16
%18 = load i32, i32* %2
%19 = load i32, i32* %4
%20 = srem i32 %18, %19
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load i32, i32* %4
%24 = sub nsw i32 %23, 1
store i32 %24, i32* %4
br label %17
25: ; preds = %17
br label %26
26: ; preds = %37, %25
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = srem i32 %27, %28
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %37
31: ; preds = %26
%32 = load i32, i32* %2
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %32, i32 %33, i32 %34)
%36 = call i32 @_exit(i32 0)
unreachable
37: ; preds = %26
%38 = load i32, i32* %4
%39 = add nsw i32 %38, -1
store i32 %39, i32* %4
br label %26
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [23 x i8] c"GCD of %d & %d is: %d\0A\00"
@str = [15 x i8] c"Enter the no1:\00"
@str.4 = [15 x i8] c"Enter the no2:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.4, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp sgt i32 %9, %10
%12 = select i1 %11, i32 %10, i32 %9
br label %13
13: ; preds = %13, %0
%14 = phi i32 [ %12, %0 ], [ %17, %13 ]
%15 = srem i32 %9, %14
%16 = icmp eq i32 %15, 0
%17 = add nsw i32 %14, -1
br i1 %16, label %18, label %13
18: ; preds = %13, %18
%19 = phi i32 [ %22, %18 ], [ %14, %13 ]
%20 = srem i32 %10, %19
%21 = icmp eq i32 %20, 0
%22 = add nsw i32 %19, -1
br i1 %21, label %23, label %18
23: ; preds = %18
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %9, i32 %10, i32 %19)
%25 = call i32 @_exit(i32 0)
unreachable
}