#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*/ addSpaces(int, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void print_fraction(int whole, int nom, int denom) {
  if (whole == 0) {
    printf("%d\n", nom);
    printf("-\n");
    printf("%d\n", denom);
  } else if ((nom == 0) || (denom == 0)) {
    printf("%d\n", whole);
  } else {
    addSpaces(nom, whole);
    printf("  %d\n", nom);
    printf("%d -\n", whole);
    addSpaces(denom, whole);
    printf("  %d\n", denom);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<print_fraction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1180 <print_fraction+0x50>
mov    -0x8(%rbp),%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f8 <print_fraction+0xc8>
cmpl   $0x0,-0x8(%rbp)
je     1194 <print_fraction+0x64>
cmpl   $0x0,-0xc(%rbp)
jne    11aa <print_fraction+0x7a>
mov    -0x4(%rbp),%esi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f3 <print_fraction+0xc3>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1040 <addSpaces@plt>
mov    -0x8(%rbp),%esi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1040 <addSpaces@plt>
mov    -0xc(%rbp),%esi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f8 <print_fraction+0xc8>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<print_fraction>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%ebx
test   %edi,%edi
jne    1171 <print_fraction+0x31>
lea    0xeab(%rip),%r15
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
jmp    11be <print_fraction+0x7e>
mov    %edi,%ebp
lea    0xe88(%rip),%r15
test   %ebx,%ebx
je     11bb <print_fraction+0x7b>
test   %r14d,%r14d
je     11bb <print_fraction+0x7b>
mov    %ebx,%edi
mov    %ebp,%esi
call   1050 <addSpaces@plt>
lea    0xe6d(%rip),%r15
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe60(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14d,%edi
mov    %ebp,%esi
call   1050 <addSpaces@plt>
jmp    11be <print_fraction+0x7e>
mov    %ebp,%r14d
mov    %r15,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"-\0A\00"
@.str.2 = [6 x i8] c" %d\0A\00"
@.str.3 = [6 x i8] c"%d -\0A\00"
define void @print_fraction(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = load i32, i32* %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %38
15: ; preds = %3
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18, %15
%22 = load i32, i32* %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %37
24: ; preds = %18
%25 = load i32, i32* %5
%26 = load i32, i32* %4
%27 = call i32 @addSpaces(i32 %25, i32 %26)
%28 = load i32, i32* %5
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %4
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %6
%33 = load i32, i32* %4
%34 = call i32 @addSpaces(i32 %32, i32 %33)
%35 = load i32, i32* %6
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %24, %21
br label %38
38: ; preds = %37, %9
%39 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.2 = [6 x i8] c" %d\0A\00"
@.str.3 = [6 x i8] c"%d -\0A\00"
@str = [2 x i8] c"-\00"
define void @print_fraction(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %17
8: ; preds = %3
%9 = icmp eq i32 %1, 0
%10 = icmp eq i32 %2, 0
%11 = or i1 %9, %10
br i1 %11, label %17, label %12
12: ; preds = %8
%13 = tail call i32 @addSpaces(i32 %1, i32 %0)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %1)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %0)
%16 = tail call i32 @addSpaces(i32 %2, i32 %0)
br label %17
17: ; preds = %8, %12, %5
%18 = phi i32 [ %2, %12 ], [ %2, %5 ], [ %0, %8 ]
%19 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %12 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %5 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %8 ]
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %19, i32 %18)
%21 = tail call i32 @exit(i32 0)
unreachable
}