#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 */
float baby(float);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float input, output;
  printf("Enter the quantity you plan on feeding the baby %c ", 16);
  scanf("%f", &input);
  while (getchar() != '\n')
    continue;
  output = baby(input);
  printf("\n\n\tAccording to the computer, baby will\n");
  printf("produce %.2f material as output.\n", output);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x10,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     118a <main+0x4a>
jmp    1172 <main+0x32>
movss  -0x8(%rbp),%xmm0
call   1050 <baby@plt>
movss  %xmm0,-0xc(%rbp)
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    1180 <main+0x30>
movss  0x4(%rsp),%xmm0
call   1060 <baby@plt>
movss  %xmm0,(%rsp)
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe80(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [52 x i8] c"Enter the quantity you plan on feeding the baby %c \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [41 x i8] c"\0A\0A\09According to the computer, baby will\0A\00"
@.str.3 = [34 x i8] c"produce %.2f material as output.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 16)
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
br label %6
6: ; preds = %10, %0
%7 = call signext i8 (...) @getchar()
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 10
br i1 %9, label %10, label %11
10: ; preds = %6
br label %6
11: ; preds = %6
%12 = load float, float* %2
%13 = call float @baby(float %12)
store float %13, float* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%15 = load float, float* %3
%16 = fpext float %15 to double
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), double %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [52 x i8] c"Enter the quantity you plan on feeding the baby %c \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.3 = [34 x i8] c"produce %.2f material as output.\0A\00"
@str = [40 x i8] c"\0A\0A\09According to the computer, baby will\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 16)
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
br label %5
5: ; preds = %5, %0
%6 = call signext i8 (...) @getchar()
%7 = icmp eq i8 %6, 10
br i1 %7, label %8, label %5
8: ; preds = %5
%9 = load float, float* %1
%10 = call float @baby(float %9)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%12 = fpext float %10 to double
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), double %12)
ret i32 0
}