#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 */
float get(char *);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ screwUp();
void divide() {
  float firstNum = get("Enter your first number");
  float secondNum = get("Enter your second number (not 0)");
  if (secondNum == 0) {
    screwUp();
    return;
  }
  float result = firstNum / secondNum;
  printf("Result: %f", result);
}


x86 assembly (clang, -O0):
<divide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1050 <get@plt>
movss  %xmm0,-0x4(%rbp)
lea    0xec8(%rip),%rdi
call   1050 <get@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    117d <divide+0x4d>
jp     117d <divide+0x4d>
mov    $0x0,%al
call   1040 <screwUp@plt>
jmp    119d <divide+0x6d>
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<divide>:
push   %rax
lea    0xec8(%rip),%rdi
call   1050 <get@plt>
movss  %xmm0,0x4(%rsp)
lea    0xece(%rip),%rdi
call   1050 <get@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1161 <divide+0x31>
jp     1161 <divide+0x31>
xor    %eax,%eax
pop    %rcx
jmp    1040 <screwUp@plt>
movss  0x4(%rsp),%xmm1
divss  %xmm0,%xmm1
lea    0xec7(%rip),%rdi
movaps %xmm1,%xmm0
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Enter your first number\00"
@.str.1 = [33 x i8] c"Enter your second number (not 0)\00"
@.str.2 = [11 x i8] c"Result: %f\00"
define void @divide() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = call float @get(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store float %4, float* %1
%5 = call float @get(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
store float %5, float* %2
%6 = load float, float* %2
%7 = fcmp oeq float %6, 0.000000e+00
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (...) @screwUp()
br label %16
10: ; preds = %0
%11 = load float, float* %1
%12 = load float, float* %2
%13 = fdiv float %11, %12
store float %13, float* %3
%14 = load float, float* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), float %14)
br label %16
16: ; preds = %10, %8
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Enter your first number\00"
@.str.1 = [33 x i8] c"Enter your second number (not 0)\00"
@.str.2 = [11 x i8] c"Result: %f\00"
define void @divide() {
%1 = tail call float @get(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = tail call float @get(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%3 = fcmp oeq float %2, 0.000000e+00
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 (...) @screwUp()
br label %9
6: ; preds = %0
%7 = fdiv float %1, %2
%8 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), float %7)
br label %9
9: ; preds = %6, %4
ret void
}