#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int a = 0, b = 0, gcd;
  while (a <= 0 || b <= 0) {
    printf("Please input two non-negative integers: ");
    scanf(" %d %d", &a, &b);
  }
  gcd = (a > b) ? b : a;
  while (a % gcd != 0 || b % gcd != 0) {
    gcd--;
  }
  printf("GCD: %d between input %d and %d.\n", gcd, a, b);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jle    1156 <main+0x36>
cmpl   $0x0,-0xc(%rbp)
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1166 <main+0x46>
jmp    118d <main+0x6d>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
jmp    113d <main+0x1d>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11a4 <main+0x84>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11aa <main+0x8a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    $0x1,%al
cmp    $0x0,%edx
mov    %al,-0x19(%rbp)
jne    11d5 <main+0xb5>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11e5 <main+0xc5>
jmp    11f3 <main+0xd3>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    11b0 <main+0x90>
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2dcf(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xec2(%rip),%r14
lea    0xee4(%rip),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%rbx
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
jle    1150 <main+0x30>
mov    (%rsp),%r8d
test   %r8d,%r8d
jle    1150 <main+0x30>
cmp    %r8d,%ecx
mov    %ecx,%esi
cmova  %r8d,%esi
jmp    1193 <main+0x73>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffff,%esi
mov    %ecx,%eax
cltd
idiv   %esi
test   %edx,%edx
jne    1190 <main+0x70>
mov    %r8d,%eax
cltd
idiv   %esi
test   %edx,%edx
jne    1190 <main+0x70>
lea    0xe83(%rip),%rdi
mov    %ecx,%edx
mov    %r8d,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Please input two non-negative integers: \00"
@.str.1 = [7 x i8] c" %d %d\00"
@.str.2 = [34 x i8] c"GCD: %d between input %d and %d.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %13, %0
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = load i32, i32* %3
%10 = icmp sle i32 %9, 0
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ true, %5 ], [ %10, %8 ]
br i1 %12, label %13, label %16
13: ; preds = %11
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
br label %5
16: ; preds = %11
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = load i32, i32* %3
br label %24
22: ; preds = %16
%23 = load i32, i32* %2
br label %24
24: ; preds = %22, %20
%25 = phi i32 [ %21, %20 ], [ %23, %22 ]
store i32 %25, i32* %4
br label %26
26: ; preds = %38, %24
%27 = load i32, i32* %2
%28 = load i32, i32* %4
%29 = srem i32 %27, %28
%30 = icmp ne i32 %29, 0
br i1 %30, label %36, label %31
31: ; preds = %26
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = srem i32 %32, %33
%35 = icmp ne i32 %34, 0
br label %36
36: ; preds = %31, %26
%37 = phi i1 [ true, %26 ], [ %35, %31 ]
br i1 %37, label %38, label %41
38: ; preds = %36
%39 = load i32, i32* %4
%40 = add nsw i32 %39, -1
store i32 %40, i32* %4
br label %26
41: ; preds = %36
%42 = load i32, i32* %4
%43 = load i32, i32* %2
%44 = load i32, i32* %3
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %42, i32 %43, i32 %44)
%46 = load i32, i32* @EXIT_SUCCESS
ret i32 %46
}

LLVM IR (-O2):
@.str = [41 x i8] c"Please input two non-negative integers: \00"
@.str.1 = [7 x i8] c" %d %d\00"
@.str.2 = [34 x i8] c"GCD: %d between input %d and %d.\0A\00"
@EXIT_SUCCESS = global i32 0
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
br label %5
5: ; preds = %0, %5
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 1
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 1
%12 = select i1 %9, i1 true, i1 %11
br i1 %12, label %5, label %13
13: ; preds = %5
%14 = icmp ugt i32 %8, %10
%15 = select i1 %14, i32 %10, i32 %8
br label %16
16: ; preds = %23, %13
%17 = phi i32 [ %15, %13 ], [ %24, %23 ]
%18 = srem i32 %8, %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = srem i32 %10, %17
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %16, %20
%24 = add nsw i32 %17, -1
br label %16
25: ; preds = %20
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 %8, i32 %10)
%27 = load i32, i32* @EXIT_SUCCESS
ret i32 %27
}