#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 *);
void main() {
  int n, m, MCD, i;
  do {
    printf("Inserire n = ");
    scanf("%d", &n);
    printf("Inserire m = ");
    scanf("%d", &m);
  } while (n < 1 || m < 1);
  for (i = 1; i <= n && i <= m; i++)
    if (n % i == 0 && m % i == 0)
      MCD = i;
  printf("l'MCD e' %d\n", MCD);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x11(%rbp)
jl     117d <main+0x5d>
cmpl   $0x1,-0x8(%rbp)
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1128 <main+0x8>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    -0x4(%rbp),%ecx
mov    %al,-0x12(%rbp)
jg     11ac <main+0x8c>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
setle  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    11bc <main+0x9c>
jmp    11f5 <main+0xd5>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11e2 <main+0xc2>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11e2 <main+0xc2>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11e7 <main+0xc7>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118f <main+0x6f>
mov    -0xc(%rbp),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%r14
lea    0xed3(%rip),%rbx
lea    0xc(%rsp),%r15
lea    0xeca(%rip),%r12
lea    0x8(%rsp),%r13
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
jle    1150 <main+0x30>
mov    0x8(%rsp),%edi
test   %edi,%edi
jle    1150 <main+0x30>
mov    $0x1,%ebx
nop
mov    %ecx,%eax
cltd
idiv   %ebx
test   %edx,%edx
jne    11a3 <main+0x83>
mov    %edi,%eax
cltd
idiv   %ebx
test   %edx,%edx
cmove  %ebx,%esi
cmp    %ecx,%ebx
jge    11b0 <main+0x90>
lea    0x1(%rbx),%eax
cmp    %edi,%ebx
mov    %eax,%ebx
jl     1190 <main+0x70>
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Inserire n = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"Inserire m = \00"
@.str.3 = [13 x i8] c"l'MCD e' %d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
br label %5
5: ; preds = %16, %0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %10
10: ; preds = %5
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 1
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 1
br label %16
16: ; preds = %13, %10
%17 = phi i1 [ true, %10 ], [ %15, %13 ]
br i1 %17, label %5, label %18
18: ; preds = %16
store i32 1, i32* %4
br label %19
19: ; preds = %42, %18
%20 = load i32, i32* %4
%21 = load i32, i32* %1
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i32, i32* %4
%25 = load i32, i32* %2
%26 = icmp sle i32 %24, %25
br label %27
27: ; preds = %23, %19
%28 = phi i1 [ false, %19 ], [ %26, %23 ]
br i1 %28, label %29, label %45
29: ; preds = %27
%30 = load i32, i32* %1
%31 = load i32, i32* %4
%32 = srem i32 %30, %31
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %41
34: ; preds = %29
%35 = load i32, i32* %2
%36 = load i32, i32* %4
%37 = srem i32 %35, %36
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = load i32, i32* %4
store i32 %40, i32* %3
br label %41
41: ; preds = %39, %34, %29
br label %42
42: ; preds = %41
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %19
45: ; preds = %27
%46 = load i32, i32* %3
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %46)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"Inserire n = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"Inserire m = \00"
@.str.3 = [13 x i8] c"l'MCD e' %d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %5, %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %1
%11 = icmp slt i32 %10, 1
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 1
%14 = select i1 %11, i1 true, i1 %13
br i1 %14, label %5, label %15
15: ; preds = %5, %24
%16 = phi i32 [ %26, %24 ], [ 1, %5 ]
%17 = phi i32 [ %25, %24 ], [ undef, %5 ]
%18 = srem i32 %10, %16
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = srem i32 %12, %16
%22 = icmp eq i32 %21, 0
%23 = select i1 %22, i32 %16, i32 %17
br label %24
24: ; preds = %20, %15
%25 = phi i32 [ %17, %15 ], [ %23, %20 ]
%26 = add nuw nsw i32 %16, 1
%27 = icmp slt i32 %16, %10
%28 = icmp slt i32 %16, %12
%29 = select i1 %27, i1 %28, i1 false
br i1 %29, label %15, label %30
30: ; preds = %24
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %25)
ret void
}