#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 /*<<< orphan*/ scanf(char *, double *);
int main() {
  double a;
  int b;
  printf("Insert: ");
  scanf("%lf", &a);
  b = a;
  if (a == b) {
    printf("Da");
  } else {
    printf("Nu");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cvttsd2si -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jne    117e <main+0x5e>
jp     117e <main+0x5e>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    118a <main+0x6a>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
cvttpd2dq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm1
ucomisd %xmm0,%xmm1
lea    0xebc(%rip),%rax
lea    0xeb2(%rip),%rdi
cmovne %rax,%rdi
cmovp  %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Insert: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [3 x i8] c"Da\00"
@.str.3 = [3 x i8] c"Nu\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%6 = load double, double* %2
%7 = fptosi double %6 to i32
store i32 %7, i32* %3
%8 = load double, double* %2
%9 = load i32, i32* %3
%10 = sitofp i32 %9 to double
%11 = fcmp oeq double %8, %10
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %16
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"Insert: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [3 x i8] c"Da\00"
@.str.3 = [3 x i8] c"Nu\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %1
%6 = fptosi double %5 to i32
%7 = sitofp i32 %6 to double
%8 = fcmp oeq double %5, %7
%9 = select i1 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%10 = call i32 @printf(i8* dereferenceable(1) %9)
ret i32 0
}