#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 EOF;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, ...);
int main(void) {
  int exit_status = EXIT_SUCCESS;
  for (;;) {
    double number;
    int scanrc = scanf("%lg", &number);
    if (scanrc == EOF)
      break;
    if (scanrc == 1) {
      printf("number = %.15g\n", number);
    } else {
      exit_status = EXIT_FAILURE;
      char buffer[1024];
      scanrc = scanf("%1023s", buffer);
      assert(scanrc == 1);
      printf("bad input \"%s\"\n", buffer);
    }
  }
  return exit_status;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
lea    0xeab(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e7b(%rip),%rcx
cmp    (%rcx),%eax
jne    117a <main+0x4a>
jmp    11eb <main+0xbb>
cmpl   $0x1,-0x14(%rbp)
jne    119c <main+0x6c>
movsd  -0x10(%rbp),%xmm0
lea    0xe74(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11e6 <main+0xb6>
mov    0x2e35(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
lea    -0x420(%rbp),%rsi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0x420(%rbp),%rsi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114e <main+0x1e>
mov    -0x8(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    0x2e88(%rip),%rax
mov    (%rax),%r15d
lea    0xeae(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x2e83(%rip),%r12
cmp    (%r12),%eax
jne    1180 <main+0x50>
mov    %r15d,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe79(%rip),%r13
lea    0x8(%rsp),%rbp
lea    0x10(%rsp),%rbx
lea    0xe83(%rip),%r14
jmp    11e9 <main+0xb9>
nopw   0x0(%rax,%rax,1)
mov    0x2e31(%rip),%rax
mov    (%rax),%r15d
lea    0xe63(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    (%r12),%eax
je     116b <main+0x3b>
cmp    $0x1,%eax
jne    11a0 <main+0x70>
movsd  0x8(%rsp),%xmm0
lea    0xe09(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11d6 <main+0xa6>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@.str = [4 x i8] c"%lg\00"
@EOF = global i32 0
@.str.1 = [16 x i8] c"number = %.15g\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [7 x i8] c"%1023s\00"
@.str.3 = [16 x i8] c"bad input \22%s\22\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca i32
%5 = alloca [1024 x i8]
store i32 0, i32* %1
%6 = load i32, i32* @EXIT_SUCCESS
store i32 %6, i32* %2
br label %7
7: ; preds = %29, %0
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %7
br label %30
13: ; preds = %7
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load double, double* %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %17)
br label %29
19: ; preds = %13
%20 = load i32, i32* @EXIT_FAILURE
store i32 %20, i32* %2
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %21)
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 1
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %19, %16
br label %7
30: ; preds = %12
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@.str = [4 x i8] c"%lg\00"
@EOF = global i32 0
@.str.1 = [16 x i8] c"number = %.15g\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [7 x i8] c"%1023s\00"
@.str.3 = [16 x i8] c"bad input \22%s\22\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca [1024 x i8]
%3 = load i32, i32* @EXIT_SUCCESS
%4 = bitcast double* %1 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %29, label %8
8: ; preds = %0
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
br label %10
10: ; preds = %8, %24
%11 = phi i32 [ %5, %8 ], [ %26, %24 ]
%12 = phi i32 [ %3, %8 ], [ %25, %24 ]
%13 = icmp eq i32 %11, 1
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load double, double* %1
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %15)
br label %24
17: ; preds = %10
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%20 = icmp eq i32 %19, 1
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %9)
br label %24
24: ; preds = %14, %17
%25 = phi i32 [ %12, %14 ], [ %18, %17 ]
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%27 = load i32, i32* @EOF
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %10
29: ; preds = %24, %0
%30 = phi i32 [ %3, %0 ], [ %25, %24 ]
ret i32 %30
}