#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 /*<<< orphan*/ simplify(int *, int *);
int specialFraction(int, int);
int main(void) {
  int numerator1;
  int denominator1;
  int num1;
  int num2;
  int fractionCase;
  printf("Numerator:\t");
  scanf("%d", &numerator1);
  printf("Denominator:\t");
  scanf("%d", &denominator1);
  printf("\n");
  fractionCase = specialFraction(numerator1, denominator1);
  if (fractionCase == 1) {
    num1 = numerator1;
    num2 = denominator1;
    simplify(&numerator1, &denominator1);
    printf("%d / %d = %d / %d\n", num1, num2, numerator1, denominator1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8a(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <specialFraction@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    11e5 <main+0xa5>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <simplify@plt>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea4(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1070 <specialFraction@plt>
cmp    $0x1,%eax
jne    11d7 <main+0x87>
mov    0x4(%rsp),%ebx
mov    (%rsp),%ebp
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <simplify@plt>
mov    0x4(%rsp),%ecx
mov    (%rsp),%r8d
lea    0xe51(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Numerator:\09\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"Denominator:\09\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [19 x i8] c"%d / %d = %d / %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = call i32 @specialFraction(i32 %12, i32 %13)
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %26
17: ; preds = %0
%18 = load i32, i32* %2
store i32 %18, i32* %4
%19 = load i32, i32* %3
store i32 %19, i32* %5
%20 = call i32 @simplify(i32* %2, i32* %3)
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %21, i32 %22, i32 %23, i32 %24)
br label %26
26: ; preds = %17, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Numerator:\09\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"Denominator:\09\00"
@.str.4 = [19 x i8] c"%d / %d = %d / %d\0A\00"
define i32 @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 ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 @putchar(i32 10)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = call i32 @specialFraction(i32 %10, i32 %11)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %21
14: ; preds = %0
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = call i32 @simplify(i32* %1, i32* %2)
%18 = load i32, i32* %1
%19 = load i32, i32* %2
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %15, i32 %16, i32 %18, i32 %19)
br label %21
21: ; preds = %14, %0
ret i32 0
}