#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 /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int x, y, m, i;
  printf("Insert any two number: ");
  scanf("%d%d", &x, &y);
  if (x > y)
    m = y;
  else
    m = x;
  for (i = m; i >= 1; i--) {
    if (x % i == 0 && y % i == 0) {
      printf("\nGCD of two number is : %d", i);
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1168 <main+0x48>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    116e <main+0x4e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     11c7 <main+0xa7>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    11b4 <main+0x94>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    11b4 <main+0x94>
mov    -0x14(%rbp),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c7 <main+0xa7>
jmp    11b9 <main+0x99>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1174 <main+0x54>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
mov    (%rsp),%edi
cmp    %edi,%ecx
mov    %ecx,%esi
cmovg  %edi,%esi
test   %esi,%esi
jg     116a <main+0x4a>
jmp    118a <main+0x6a>
nopw   0x0(%rax,%rax,1)
lea    -0x1(%rsi),%eax
cmp    $0x1,%esi
mov    %eax,%esi
jle    118a <main+0x6a>
mov    %ecx,%eax
cltd
idiv   %esi
test   %edx,%edx
jne    1160 <main+0x40>
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
jne    1160 <main+0x40>
lea    0xe9a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [24 x i8] c"Insert any two number: \00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [27 x i8] c"\0AGCD of two number is : %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 ([24 x i8], [24 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 = load i32, i32* %2
%9 = icmp sgt i32 %7, %8
%10 = select i1 %9, i32 %8, i32 %7
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %24
12: ; preds = %0, %21
%13 = phi i32 [ %22, %21 ], [ %10, %0 ]
%14 = srem i32 %7, %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = srem i32 %8, %13
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %13)
br label %24
21: ; preds = %12, %16
%22 = add nsw i32 %13, -1
%23 = icmp sgt i32 %13, 1
br i1 %23, label %12, label %24
24: ; preds = %21, %0, %19
ret i32 0
}