#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 gcd(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int M = 0;
  int N = 0;
  printf("Please enter two number .I will help you to figure out M%%N.Makesure "
         "your number all are positive!");
  printf("\n\nPlease enter the value of M\n");
  while (!scanf("%d", &M)) {
    printf("The data you entered is wrong ,please enter again !\n\n");
  }
  printf("Please enter the value of N\n");
  while (!scanf("%d", &N)) {
    printf("The data you entered is wrong ,please enter again !\n\n");
  }
  printf("The data after process: %d\n", gcd(M, N));
  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)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf12(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    118e <main+0x5e>
jmp    11a1 <main+0x71>
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1169 <main+0x39>
lea    0xf13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11d4 <main+0xa4>
jmp    11e7 <main+0xb7>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11af <main+0x7f>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <gcd@plt>
mov    %eax,%esi
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf14(%rip),%rdi
call   1030 <puts@plt>
lea    0xee9(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
test   %eax,%eax
jne    11b7 <main+0x77>
lea    0xf2d(%rip),%r14
lea    0xecd(%rip),%r15
lea    0xc(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
test   %eax,%eax
je     11a0 <main+0x60>
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
lea    0xe99(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
test   %eax,%eax
jne    1207 <main+0xc7>
lea    0xedd(%rip),%r14
lea    0xe7d(%rip),%r15
lea    0x8(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
test   %eax,%eax
je     11f0 <main+0xb0>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1060 <gcd@plt>
lea    0xe4b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [99 x i8] c"Please enter two number .I will help you to figure out M%%N.Makesure your number all are positive!\00"
@.str.1 = [31 x i8] c"\0A\0APlease enter the value of M\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [54 x i8] c"The data you entered is wrong ,please enter again !\0A\0A\00"
@.str.4 = [29 x i8] c"Please enter the value of N\0A\00"
@.str.5 = [28 x i8] c"The data after process: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %10, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0))
br label %6
12: ; preds = %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %18, %12
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0))
br label %14
20: ; preds = %14
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = call i32 @gcd(i32 %21, i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [99 x i8] c"Please enter two number .I will help you to figure out M%%N.Makesure your number all are positive!\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.5 = [28 x i8] c"The data after process: %d\0A\00"
@str = [30 x i8] c"\0A\0APlease enter the value of M\00"
@str.6 = [28 x i8] c"Please enter the value of N\00"
@str.8 = [53 x i8] c"The data you entered is wrong ,please enter again !\0A\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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %0, %9
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.8, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %9, label %13
13: ; preds = %9, %0
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.6, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %13, %17
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.8, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%20 = icmp eq i32 %19, 0
br i1 %20, label %17, label %21
21: ; preds = %17, %13
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = call i32 @gcd(i32 %22, i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %24)
ret i32 0
}