#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, double);
int /*<<< orphan*/ sscanf(char *, char *, double *);
int /*<<< orphan*/ stdin;
void AskDouble(char *question, double *answer) {
  char reply[256];
  printf("%s <%lg> ==> ", question, *answer);
  fgets(reply, 256, stdin);
  if (reply[0])
    sscanf(reply, "%le", answer);
}


x86 assembly (clang, -O0):
<AskDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e7f(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1040 <fgets@plt>
cmpb   $0x0,-0x110(%rbp)
je     1199 <AskDouble+0x69>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe7a(%rip),%rsi
call   1050 <sscanf@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AskDouble>:
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%rbx
mov    %rdi,%rsi
movsd  (%rbx),%xmm0
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x100,%esi
call   1040 <fgets@plt>
cmpb   $0x0,(%rsp)
je     117c <AskDouble+0x4c>
lea    0xe9d(%rip),%rsi
mov    %rsp,%rdi
mov    %rbx,%rdx
call   1050 <sscanf@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%s <%lg> ==> \00"
@stdin = global i32 0
@.str.1 = [4 x i8] c"%le\00"
define void @AskDouble(i8* %0, double* %1) {
%3 = alloca i8*
%4 = alloca double*
%5 = alloca [256 x i8]
store i8* %0, i8** %3
store double* %1, double** %4
%6 = load i8*, i8** %3
%7 = load double*, double** %4
%8 = load double, double* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %6, double %8)
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %10, i32 256, i32 %11)
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%14 = load i8, i8* %13
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%18 = load double*, double** %4
%19 = call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %18)
br label %20
20: ; preds = %16, %2
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s <%lg> ==> \00"
@stdin = global i32 0
@.str.1 = [4 x i8] c"%le\00"
define void @AskDouble(i8* %0, double* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = load double, double* %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0, double %5)
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %4, i32 256, i32 %7)
%9 = load i8, i8* %4
%10 = icmp eq i8 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
br label %13
13: ; preds = %11, %2
ret void
}