#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 div(float, float);
int errno;
int idiv(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, ...);
void main(void) {
  float x;
  int y;
  x = div(0.0f, 0.0f);
  printf("ERR=%d, VALUE=%f\n", errno, x);
  x = div(1.0f, 0.0f);
  printf("ERR=%d, VALUE=%f\n", errno, x);
  y = idiv(0, 0);
  printf("%d\n", y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
call   1040 <div@plt>
movss  %xmm0,-0x4(%rbp)
mov    0x2e91(%rip),%rax
mov    (%rax),%esi
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xe90(%rip),%xmm0
xorps  %xmm1,%xmm1
call   1040 <div@plt>
movss  %xmm0,-0x4(%rbp)
mov    0x2e5c(%rip),%rax
mov    (%rax),%esi
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1050 <idiv@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   1040 <div@plt>
mov    0x2e9a(%rip),%r14
mov    (%r14),%esi
cvtss2sd %xmm0,%xmm0
lea    0xeb0(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xe9a(%rip),%xmm0
xorps  %xmm1,%xmm1
call   1040 <div@plt>
mov    (%r14),%esi
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1050 <idiv@plt>
lea    0xe87(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"ERR=%d, VALUE=%f\0A\00"
@errno = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = alloca float
%2 = alloca i32
%3 = call float @div(float 0.000000e+00, float 0.000000e+00)
store float %3, float* %1
%4 = load i32, i32* @errno
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4, double %6)
%8 = call float @div(float 1.000000e+00, float 0.000000e+00)
store float %8, float* %1
%9 = load i32, i32* @errno
%10 = load float, float* %1
%11 = fpext float %10 to double
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %9, double %11)
%13 = call i32 @idiv(i32 0, i32 0)
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"ERR=%d, VALUE=%f\0A\00"
@errno = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = tail call float @div(float 0.000000e+00, float 0.000000e+00)
%2 = load i32, i32* @errno
%3 = fpext float %1 to double
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2, double %3)
%5 = tail call float @div(float 1.000000e+00, float 0.000000e+00)
%6 = load i32, i32* @errno
%7 = fpext float %5 to double
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %6, double %7)
%9 = tail call i32 @idiv(i32 0, i32 0)
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret void
}