#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*/ fprintf(int /*<<< orphan*/, char *, double);
int /*<<< orphan*/ set_line(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  double value;
  char buf[1024] = {0};
  extern double parse_line(void);
  while (NULL != fgets(buf, 1024, stdin)) {
    set_line(buf);
    value = parse_line();
    fprintf(stdout, ">> %lf\n", value);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
lea    -0x420(%rbp),%rdi
mov    0x2e5e(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1050 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     11d9 <main+0x89>
lea    -0x420(%rbp),%rdi
call   1030 <set_line@plt>
call   1070 <parse_line@plt>
movsd  %xmm0,-0x18(%rbp)
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
movsd  -0x18(%rbp),%xmm0
lea    0xe31(%rip),%rsi
call   1060 <fprintf@plt>
jmp    117c <main+0x2c>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rsp,%rbx
mov    $0x400,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    0x2e71(%rip),%r15
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11ce <main+0x7e>
mov    %rsp,%rbx
mov    0x2e42(%rip),%r12
lea    0xe63(%rip),%r14
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <set_line@plt>
call   1070 <parse_line@plt>
mov    (%r12),%edi
mov    %r14,%rsi
call   1060 <fprintf@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
test   %rax,%rax
jne    11a0 <main+0x50>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@stdout = global i32 0
@.str = [8 x i8] c">> %lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [1024 x i8]* %7 to i8*
br label %9
9: ; preds = %14, %2
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%11 = load i32, i32* @stdin
%12 = call i32* @fgets(i8* %10, i32 1024, i32 %11)
%13 = icmp ne i32* null, %12
br i1 %13, label %14, label %21
14: ; preds = %9
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%16 = call i32 @set_line(i8* %15)
%17 = call double @parse_line()
store double %17, double* %6
%18 = load i32, i32* @stdout
%19 = load double, double* %6
%20 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %19)
br label %9
21: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@stdout = global i32 0
@.str = [8 x i8] c">> %lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32* @fgets(i8* %4, i32 1024, i32 %5)
%7 = icmp eq i32* %6, null
br i1 %7, label %16, label %8
8: ; preds = %2, %8
%9 = call i32 @set_line(i8* %4)
%10 = call double @parse_line()
%11 = load i32, i32* @stdout
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %10)
%13 = load i32, i32* @stdin
%14 = call i32* @fgets(i8* %4, i32 1024, i32 %13)
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %8
16: ; preds = %8, %2
ret i32 0
}