#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 CommonFactors(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(int argc, char const *argv[]) {
  int a, b, n, ret, max, min, min2;
  printf("%s\n", "Input a and b:");
  scanf("%d %d", &a, &b);
  max = a >= b ? a : b;
  min = a >= b ? b : a;
  printf("%d\n", CommonFactors(max, min));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     1186 <main+0x56>
mov    -0x14(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    118c <main+0x5c>
mov    -0x18(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     11a9 <main+0x79>
mov    -0x18(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    11af <main+0x7f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1050 <CommonFactors@plt>
mov    %eax,%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
lea    0xebb(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%esi
cmp    %esi,%eax
mov    %eax,%edi
cmovl  %esi,%edi
cmovl  %eax,%esi
call   1060 <CommonFactors@plt>
lea    0xe97(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [15 x i8] c"Input a and b:\00"
@.str.2 = [6 x i8] c"%d %d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %6, i32* %7)
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = icmp sge i32 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = load i32, i32* %6
br label %22
20: ; preds = %2
%21 = load i32, i32* %7
br label %22
22: ; preds = %20, %18
%23 = phi i32 [ %19, %18 ], [ %21, %20 ]
store i32 %23, i32* %10
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = icmp sge i32 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = load i32, i32* %7
br label %31
29: ; preds = %22
%30 = load i32, i32* %6
br label %31
31: ; preds = %29, %27
%32 = phi i32 [ %28, %27 ], [ %30, %29 ]
store i32 %32, i32* %11
%33 = load i32, i32* %10
%34 = load i32, i32* %11
%35 = call i32 @CommonFactors(i32 %33, i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %35)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"Input a and b:\00"
@.str.2 = [6 x i8] c"%d %d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
%12 = select i1 %11, i32 %10, i32 %9
%13 = select i1 %11, i32 %9, i32 %10
%14 = call i32 @CommonFactors(i32 %12, i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %14)
ret i32 0
}