#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, int, ...);
int specialFraction(int numerator, int denominator) {
  int result;
  if (numerator == 0)
    printf("%d / %d = 0\n", numerator, denominator);
  else if (denominator == 0)
    printf("%d / %d = UNDEFINED\n", numerator, denominator);
  else if (denominator == 1)
    printf("%d / %d = %d\n", numerator, denominator, numerator);
  else
    result = 1;
  return result;
}


x86 assembly (clang, -O0):
<specialFraction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1141 <specialFraction+0x31>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119b <specialFraction+0x8b>
cmpl   $0x0,-0x8(%rbp)
jne    1164 <specialFraction+0x54>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1196 <specialFraction+0x86>
cmpl   $0x1,-0x8(%rbp)
jne    118a <specialFraction+0x7a>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x4(%rbp),%ecx
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1191 <specialFraction+0x81>
movl   $0x1,-0xc(%rbp)
jmp    1196 <specialFraction+0x86>
jmp    119b <specialFraction+0x8b>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<specialFraction>:
push   %rax
mov    %esi,%edx
test   %edi,%edi
je     112d <specialFraction+0x1d>
mov    %edi,%esi
cmp    $0x1,%edx
je     113f <specialFraction+0x2f>
test   %edx,%edx
jne    1154 <specialFraction+0x44>
lea    0xee4(%rip),%rdi
xor    %edx,%edx
jmp    1136 <specialFraction+0x26>
lea    0xecc(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1154 <specialFraction+0x44>
lea    0xedc(%rip),%rdi
mov    $0x1,%edx
mov    %esi,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%d / %d = 0\0A\00"
@.str.1 = [21 x i8] c"%d / %d = UNDEFINED\0A\00"
@.str.2 = [14 x i8] c"%d / %d = %d\0A\00"
define i32 @specialFraction(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* %3
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10)
br label %30
12: ; preds = %2
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %17)
br label %29
19: ; preds = %12
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = load i32, i32* %3
%26 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %23, i32 %24, i32 %25)
br label %28
27: ; preds = %19
store i32 1, i32* %5
br label %28
28: ; preds = %27, %22
br label %29
29: ; preds = %28, %15
br label %30
30: ; preds = %29, %8
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
@.str = [13 x i8] c"%d / %d = 0\0A\00"
@.str.1 = [21 x i8] c"%d / %d = UNDEFINED\0A\00"
@.str.2 = [14 x i8] c"%d / %d = %d\0A\00"
define i32 @specialFraction(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 0, i32 %1)
br label %11
6: ; preds = %2
switch i32 %1, label %11 [
i32 0, label %7
i32 1, label %9
]
7: ; preds = %6
%8 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 0)
br label %11
9: ; preds = %6
%10 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %0, i32 1, i32 %0)
br label %11
11: ; preds = %6, %7, %9, %4
ret i32 1
}