#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 num1, num2, i, hcf;
  printf("Enter two integers: ");
  scanf("%d %d", &num1, &num2);
  for (i = 1; i <= num1 || i <= num2; ++i) {
    if (num1 % i == 0 && num2 % i == 0)
      hcf = i;
  }
  printf("H.C.F of %d and %d is %d", num1, num2, hcf);
  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    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    $0x1,%al
cmp    -0x8(%rbp),%ecx
mov    %al,-0x15(%rbp)
jle    1175 <main+0x55>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
setle  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1185 <main+0x65>
jmp    11be <main+0x9e>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11ab <main+0x8b>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11ab <main+0x8b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11b0 <main+0x90>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1158 <main+0x38>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
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    0xedf(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    $0x1,%eax
mov    (%rsp),%r8d
mov    %eax,%edi
mov    %esi,%eax
cltd
idiv   %edi
test   %edx,%edx
jne    1166 <main+0x46>
mov    %r8d,%eax
cltd
idiv   %edi
test   %edx,%edx
cmove  %edi,%ecx
lea    0x1(%rdi),%eax
cmp    %esi,%edi
jl     1150 <main+0x30>
cmp    %r8d,%edi
jl     1150 <main+0x30>
lea    0xea2(%rip),%rdi
mov    %r8d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Enter two integers: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [25 x i8] c"H.C.F of %d and %d 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 ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
store i32 1, i32* %4
br label %8
8: ; preds = %31, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %2
%11 = icmp sle i32 %9, %10
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = icmp sle i32 %13, %14
br label %16
16: ; preds = %12, %8
%17 = phi i1 [ true, %8 ], [ %15, %12 ]
br i1 %17, label %18, label %34
18: ; preds = %16
%19 = load i32, i32* %2
%20 = load i32, i32* %4
%21 = srem i32 %19, %20
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %30
23: ; preds = %18
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = srem i32 %24, %25
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %23
%29 = load i32, i32* %4
store i32 %29, i32* %5
br label %30
30: ; preds = %28, %23, %18
br label %31
31: ; preds = %30
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %8
34: ; preds = %16
%35 = load i32, i32* %2
%36 = load i32, i32* %3
%37 = load i32, i32* %5
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %35, i32 %36, i32 %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Enter two integers: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [25 x i8] c"H.C.F of %d and %d 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 ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 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, 0
%10 = icmp sgt i32 %8, 0
%11 = select i1 %9, i1 true, i1 %10
br label %12
12: ; preds = %0, %21
%13 = phi i32 [ %22, %21 ], [ undef, %0 ]
%14 = phi i32 [ %23, %21 ], [ 1, %0 ]
%15 = srem i32 %7, %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = srem i32 %8, %14
%19 = icmp eq i32 %18, 0
%20 = select i1 %19, i32 %14, i32 %13
br label %21
21: ; preds = %17, %12
%22 = phi i32 [ %13, %12 ], [ %20, %17 ]
%23 = add nuw nsw i32 %14, 1
%24 = icmp slt i32 %14, %7
%25 = icmp slt i32 %14, %8
%26 = select i1 %24, i1 true, i1 %25
br i1 %26, label %12, label %27
27: ; preds = %21
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8, i32 %22)
ret i32 0
}