#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);
void reduce_fraction(int *numerator, int *denominator) {
  int xgcd;
  if (*denominator == 0 || *numerator == 0 || *numerator == 1)
    return;
  xgcd = gcd(*numerator, *denominator);
  *numerator = *numerator / xgcd;
  *denominator = *denominator / xgcd;
}


x86 assembly (clang, -O0):
<reduce_fraction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
je     1147 <reduce_fraction+0x37>
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
je     1147 <reduce_fraction+0x37>
mov    -0x8(%rbp),%rax
cmpl   $0x1,(%rax)
jne    114c <reduce_fraction+0x3c>
jmp    1184 <reduce_fraction+0x74>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1030 <gcd@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reduce_fraction>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    (%rsi),%esi
test   %esi,%esi
je     113e <reduce_fraction+0x2e>
mov    %rdi,%r14
mov    (%rdi),%edi
cmp    $0x2,%edi
jb     113e <reduce_fraction+0x2e>
call   1030 <gcd@plt>
mov    %eax,%ecx
mov    (%r14),%eax
cltd
idiv   %ecx
mov    %eax,(%r14)
mov    (%rbx),%eax
cltd
idiv   %ecx
mov    %eax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @reduce_fraction(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %2
%10 = load i32*, i32** %3
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = load i32*, i32** %3
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %18
17: ; preds = %13, %9, %2
br label %34
18: ; preds = %13
%19 = load i32*, i32** %3
%20 = load i32, i32* %19
%21 = load i32*, i32** %4
%22 = load i32, i32* %21
%23 = call i32 @gcd(i32 %20, i32 %22)
store i32 %23, i32* %5
%24 = load i32*, i32** %3
%25 = load i32, i32* %24
%26 = load i32, i32* %5
%27 = sdiv i32 %25, %26
%28 = load i32*, i32** %3
store i32 %27, i32* %28
%29 = load i32*, i32** %4
%30 = load i32, i32* %29
%31 = load i32, i32* %5
%32 = sdiv i32 %30, %31
%33 = load i32*, i32** %4
store i32 %32, i32* %33
br label %34
34: ; preds = %18, %17
ret void
}

LLVM IR (-O2):
define void @reduce_fraction(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2
%6 = load i32, i32* %0
%7 = icmp ult i32 %6, 2
br i1 %7, label %14, label %8
8: ; preds = %5
%9 = tail call i32 @gcd(i32 %6, i32 %3)
%10 = load i32, i32* %0
%11 = sdiv i32 %10, %9
store i32 %11, i32* %0
%12 = load i32, i32* %1
%13 = sdiv i32 %12, %9
store i32 %13, i32* %1
br label %14
14: ; preds = %5, %2, %8
ret void
}