#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 *);
void main() {
  int numeroA, numeroB, resto;
  printf("Digite dois números (ordem crescente): ");
  scanf("%d %d", &numeroA, &numeroB);
  while (numeroA > 0) {
    resto = numeroB % numeroA;
    numeroB = numeroA;
    numeroA = resto;
  }
  printf("MDC: %d", numeroB);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
cmpl   $0x0,-0x4(%rbp)
jle    116f <main+0x4f>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114a <main+0x2a>
mov    -0x8(%rbp),%esi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%edx
mov    (%rsp),%esi
test   %edx,%edx
jle    1162 <main+0x42>
xchg   %ax,%ax
mov    %esi,%eax
mov    %edx,%esi
cltd
idiv   %esi
test   %edx,%edx
jg     1150 <main+0x30>
mov    %esi,(%rsp)
mov    %edx,0x4(%rsp)
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Digite dois n\C3\BAmeros (ordem crescente): \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [8 x i8] c"MDC: %d\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
br label %6
6: ; preds = %9, %0
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = load i32, i32* %2
%11 = load i32, i32* %1
%12 = srem i32 %10, %11
store i32 %12, i32* %3
%13 = load i32, i32* %1
store i32 %13, i32* %2
%14 = load i32, i32* %3
store i32 %14, i32* %1
br label %6
15: ; preds = %6
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %16)
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"Digite dois n\C3\BAmeros (ordem crescente): \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [8 x i8] c"MDC: %d\00"
define void @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 ([41 x i8], [41 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
br i1 %9, label %10, label %16
10: ; preds = %0, %10
%11 = phi i32 [ %13, %10 ], [ %7, %0 ]
%12 = phi i32 [ %11, %10 ], [ %8, %0 ]
%13 = srem i32 %12, %11
%14 = icmp sgt i32 %13, 0
br i1 %14, label %10, label %15
15: ; preds = %10
store i32 %11, i32* %2
store i32 %13, i32* %1
br label %16
16: ; preds = %15, %0
%17 = phi i32 [ %11, %15 ], [ %8, %0 ]
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %17)
ret void
}