#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 */
typedef int ssize_t;

/* Variables and functions */
float atof(char *);
int /*<<< orphan*/ free(char *);
int getline(char **, size_t *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ stdin;
void get_num(float *degrees) {
  char *line = NULL;
  size_t len = 0;
  ssize_t read;
  while ((read = getline(&line, &len, stdin)) != -1) {
    if ((*degrees = atof(line)))
      break;
  }
  printf("%06.3f\n", *degrees);
  free(line);
}


x86 assembly (clang, -O0):
<get_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <getline@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     11b0 <get_num+0x70>
mov    -0x10(%rbp),%rdi
call   1040 <atof@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11a6 <get_num+0x66>
jp     11a6 <get_num+0x66>
jmp    11ab <get_num+0x6b>
jmp    11b0 <get_num+0x70>
jmp    115c <get_num+0x1c>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
lea    0xe41(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_num>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    0x2e81(%rip),%r12
lea    0x8(%rsp),%r14
lea    0x10(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r12),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <getline@plt>
cmp    $0xffffffff,%eax
je     11af <get_num+0x6f>
mov    0x8(%rsp),%rdi
call   1040 <atof@plt>
movss  %xmm0,(%rbx)
ucomiss 0xe57(%rip),%xmm0
jne    11b3 <get_num+0x73>
jnp    1180 <get_num+0x40>
jmp    11b3 <get_num+0x73>
movss  (%rbx),%xmm0
lea    0xe4a(%rip),%rdi
call   1050 <printf@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [8 x i8] c"%06.3f\0A\00"
define void @get_num(float* %0) {
%2 = alloca float*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store float* %0, float** %2
store i8* null, i8** %3
store i64 0, i64* %4
br label %6
6: ; preds = %16, %1
%7 = load i32, i32* @stdin
%8 = call i32 @getline(i8** %3, i64* %4, i32 %7)
store i32 %8, i32* %5
%9 = icmp ne i32 %8, -1
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = call float @atof(i8* %11)
%13 = load float*, float** %2
store float %12, float* %13
%14 = fcmp une float %12, 0.000000e+00
br i1 %14, label %15, label %16
15: ; preds = %10
br label %17
16: ; preds = %10
br label %6
17: ; preds = %15, %6
%18 = load float*, float** %2
%19 = load float, float* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float %19)
%21 = load i8*, i8** %3
%22 = call i32 @free(i8* %21)
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [8 x i8] c"%06.3f\0A\00"
define void @get_num(float* nocapture %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%5 = bitcast i64* %3 to i8*
store i64 0, i64* %3
br label %6
6: ; preds = %12, %1
%7 = load i32, i32* @stdin
%8 = call i32 @getline(i8** %2, i64* %3, i32 %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = load float, float* %0
br label %16
12: ; preds = %6
%13 = load i8*, i8** %2
%14 = call float @atof(i8* %13)
store float %14, float* %0
%15 = fcmp une float %14, 0.000000e+00
br i1 %15, label %16, label %6
16: ; preds = %12, %10
%17 = phi float [ %11, %10 ], [ %14, %12 ]
%18 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float %17)
%19 = load i8*, i8** %2
%20 = call i32 @free(i8* %19)
ret void
}