#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_SUCCESS;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, char *);
size_t strlen(char *);
double strtod(char *, char **);
int main(int argc, char **argv) {
  assert(argc == 1);
  printf("%s:\n", argv[0]);
  for (;;) {
    char buffer[4096];
    int scanct = scanf("%4095s", buffer);
    if (scanct == EOF) {
      printf("EOF\n");
      break;
    }
    assert(scanct == 1);
    size_t length = strlen(buffer);
    char *endptr = NULL;
    double number = strtod(buffer, &endptr);
    if (*endptr == '\0') {
      printf("%22.15g %4zd \"%s\"\n", number, length, buffer);
    } else {
      printf("%-22s %4zd \"%s\", endptr->\"%s\"\n", "not numeric", length,
             buffer, endptr);
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1030,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1010(%rbp),%rsi
lea    0xe68(%rip),%rdi
call   1070 <scanf@plt>
mov    %eax,-0x1014(%rbp)
mov    -0x1014(%rbp),%eax
mov    0x2e33(%rip),%rcx
cmp    (%rcx),%eax
jne    11d0 <main+0x80>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1288 <main+0x138>
cmpl   $0x1,-0x1014(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x1010(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x1020(%rbp)
movq   $0x0,-0x1028(%rbp)
lea    -0x1010(%rbp),%rdi
lea    -0x1028(%rbp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,-0x1030(%rbp)
ff
mov    -0x1028(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1259 <main+0x109>
movsd  -0x1030(%rbp),%xmm0
ff
mov    -0x1020(%rbp),%rsi
lea    -0x1010(%rbp),%rdx
lea    0xdc4(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    1283 <main+0x133>
mov    -0x1020(%rbp),%rdx
lea    -0x1010(%rbp),%rcx
mov    -0x1028(%rbp),%r8
lea    0xdaf(%rip),%rdi
lea    0xdc7(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    118f <main+0x3f>
mov    0x2d49(%rip),%rax
mov    (%rax),%eax
add    $0x1030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1018,%rsp
mov    %rsi,%rbx
xor    %eax,%eax
cmp    $0x1,%edi
sete   %al
mov    %eax,%edi
call   1070 <assert@plt>
mov    (%rbx),%rsi
lea    0xe73(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe6a(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x2e3c(%rip),%r13
cmp    0x0(%r13),%eax
jne    11d9 <main+0x79>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%eax
add    $0x1018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r14
lea    0xe1b(%rip),%r12
lea    0xe4d(%rip),%rbp
jmp    1228 <main+0xc8>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe18(%rip),%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
cmp    0x0(%r13),%eax
je     11b2 <main+0x52>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rax,%r15
movq   $0x0,0x8(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strtod@plt>
mov    0x8(%rsp),%r8
cmpb   $0x0,(%r8)
jne    1200 <main+0xa0>
lea    0xda5(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    $0x1,%al
call   1060 <printf@plt>
jmp    1217 <main+0xb7>

LLVM IR (-O0):
@.str = [5 x i8] c"%s:\0A\00"
@.str.1 = [7 x i8] c"%4095s\00"
@EOF = global i32 0
@.str.2 = [5 x i8] c"EOF\0A\00"
@.str.3 = [19 x i8] c"%22.15g %4zd \22%s\22\0A\00"
@.str.4 = [31 x i8] c"%-22s %4zd \22%s\22, endptr->\22%s\22\0A\00"
@.str.5 = [12 x i8] c"not numeric\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4096 x i8]
%7 = alloca i32
%8 = alloca i64
%9 = alloca i8*
%10 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 1
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %50, %2
%20 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%21 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %20)
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = load i32, i32* @EOF
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %51
27: ; preds = %19
%28 = load i32, i32* %7
%29 = icmp eq i32 %28, 1
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%33 = call i64 @strlen(i8* %32)
store i64 %33, i64* %8
store i8* null, i8** %9
%34 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%35 = call double @strtod(i8* %34, i8** %9)
store double %35, double* %10
%36 = load i8*, i8** %9
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %45
40: ; preds = %27
%41 = load double, double* %10
%42 = load i64, i64* %8
%43 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %41, i64 %42, i8* %43)
br label %50
45: ; preds = %27
%46 = load i64, i64* %8
%47 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%48 = load i8*, i8** %9
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i64 %46, i8* %47, i8* %48)
br label %50
50: ; preds = %45, %40
br label %19
51: ; preds = %25
%52 = load i32, i32* @EXIT_SUCCESS
ret i32 %52
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s:\0A\00"
@.str.1 = [7 x i8] c"%4095s\00"
@EOF = global i32 0
@.str.3 = [19 x i8] c"%22.15g %4zd \22%s\22\0A\00"
@.str.4 = [31 x i8] c"%-22s %4zd \22%s\22, endptr->\22%s\22\0A\00"
@.str.5 = [12 x i8] c"not numeric\00"
@EXIT_SUCCESS = global i32 0
@str = [4 x i8] c"EOF\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = alloca i8*
%5 = icmp eq i32 %0, 1
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = load i8*, i8** %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %34, label %14
14: ; preds = %2
%15 = bitcast i8** %4 to i8*
br label %16
16: ; preds = %14, %30
%17 = phi i32 [ %11, %14 ], [ %31, %30 ]
%18 = icmp eq i32 %17, 1
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i64 @strlen(i8* %10)
store i8* null, i8** %4
%22 = call double @strtod(i8* %10, i8** %4)
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %16
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %22, i64 %21, i8* %10)
br label %30
28: ; preds = %16
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i64 %21, i8* %10, i8* %23)
br label %30
30: ; preds = %26, %28
%31 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%32 = load i32, i32* @EOF
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %16
34: ; preds = %30, %2
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%36 = load i32, i32* @EXIT_SUCCESS
ret i32 %36
}