#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 */
scalar_t__ EOF;
int /*<<< orphan*/ exit(int);
int getchar();
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, double *);
int main(void) {
  double d;
  int c;
  if (scanf("%lg", &d) != EOF) {
    printf("scanf didn't failed\n");
    exit(1);
  }
  c = getchar();
  if (c != ' ') {
    printf("c is `%c', not ` '\n", c);
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e82(%rip),%rcx
cmp    (%rcx),%rax
je     1187 <main+0x47>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x20,-0x14(%rbp)
je     11b6 <main+0x76>
mov    -0x14(%rbp),%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    0x2e81(%rip),%rcx
cmp    (%rcx),%rax
jne    117c <main+0x2c>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x20,%eax
jne    1192 <main+0x42>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    0xe6b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%lg\00"
@EOF = global i64 0
@.str.1 = [21 x i8] c"scanf didn't failed\0A\00"
@.str.2 = [20 x i8] c"c is `%c', not ` '\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
store i32 0, i32* %1
%4 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%5 = load i64, i64* @EOF
%6 = icmp ne i64 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = call i32 (...) @getchar()
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 32
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i32, i32* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lg\00"
@EOF = global i64 0
@.str.2 = [20 x i8] c"c is `%c', not ` '\0A\00"
@str = [20 x i8] c"scanf didn't failed\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %0
%10 = call i32 (...) @getchar()
%11 = icmp eq i32 %10, 32
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %9
ret i32 0
}