#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 *, ...);
float dividir(int a, int b) {
  float fa = a;
  float fb = b;
  if (fa > 0 && fb > 0) {
    fa /= fb;
    printf("\nLa division es: %.8f\n", fa);
  } else {
    printf("\nNo se puede dividir por CERO...\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<dividir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1183 <dividir+0x73>
movss  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1183 <dividir+0x73>
movss  -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe89(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1191 <dividir+0x81>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dividir>:
push   %rax
test   %edi,%edi
jle    114c <dividir+0x2c>
test   %esi,%esi
jle    114c <dividir+0x2c>
cvtsi2ss %esi,%xmm0
cvtsi2ss %edi,%xmm1
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xebd(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1158 <dividir+0x38>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0ALa division es: %.8f\0A\00"
@.str.1 = [34 x i8] c"\0ANo se puede dividir por CERO...\0A\00"
define float @dividir(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = sitofp i32 %7 to float
store float %8, float* %5
%9 = load i32, i32* %4
%10 = sitofp i32 %9 to float
store float %10, float* %6
%11 = load float, float* %5
%12 = fcmp ogt float %11, 0.000000e+00
br i1 %12, label %13, label %23
13: ; preds = %2
%14 = load float, float* %6
%15 = fcmp ogt float %14, 0.000000e+00
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = load float, float* %6
%18 = load float, float* %5
%19 = fdiv float %18, %17
store float %19, float* %5
%20 = load float, float* %5
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %21)
br label %25
23: ; preds = %13, %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %23, %16
ret float 0.000000e+00
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0ALa division es: %.8f\0A\00"
@str = [33 x i8] c"\0ANo se puede dividir por CERO...\00"
define float @dividir(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
%4 = icmp sgt i32 %1, 0
%5 = and i1 %3, %4
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = sitofp i32 %1 to float
%8 = sitofp i32 %0 to float
%9 = fdiv float %8, %7
%10 = fpext float %9 to double
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %10)
br label %14
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %12, %6
ret float 0.000000e+00
}