#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 */
double price(double, double, double, double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double r, t, a;
  printf("Input the radius ");
  scanf("%lf", &r);
  printf("Input the thickness ");
  scanf("%lf", &t);
  printf("gold   %f\n", price(1324.0, 19.3, r, t));
  printf("silver %f\n", price(17.76, 10.5, r, t));
  printf("copper %f\n", price(0.2211, 8.93, r, t));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
movsd  -0x10(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  0xe93(%rip),%xmm0
movsd  0xe93(%rip),%xmm1
call   1040 <price@plt>
lea    0xeba(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  0xe56(%rip),%xmm0
movsd  0xe56(%rip),%xmm1
call   1040 <price@plt>
lea    0xe98(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  0xe19(%rip),%xmm0
movsd  0xe19(%rip),%xmm1
call   1040 <price@plt>
lea    0xe76(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xef4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef8(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm2
movsd  (%rsp),%xmm3
movsd  0xe7d(%rip),%xmm0
movsd  0xe7d(%rip),%xmm1
call   1040 <price@plt>
lea    0xec4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm2
movsd  (%rsp),%xmm3
movsd  0xe5f(%rip),%xmm0
movsd  0xe5f(%rip),%xmm1
call   1040 <price@plt>
lea    0xea1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm2
movsd  (%rsp),%xmm3
movsd  0xe41(%rip),%xmm0
movsd  0xe41(%rip),%xmm1
call   1040 <price@plt>
lea    0xe7e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Input the radius \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [21 x i8] c"Input the thickness \00"
@.str.3 = [11 x i8] c"gold %f\0A\00"
@.str.4 = [11 x i8] c"silver %f\0A\00"
@.str.5 = [11 x i8] c"copper %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%9 = load double, double* %2
%10 = load double, double* %3
%11 = call double @price(double 1.324000e+03, double 1.930000e+01, double %9, double %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), double %11)
%13 = load double, double* %2
%14 = load double, double* %3
%15 = call double @price(double 1.776000e+01, double 1.050000e+01, double %13, double %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), double %15)
%17 = load double, double* %2
%18 = load double, double* %3
%19 = call double @price(double 2.211000e-01, double 0x4021DC28F5C28F5C, double %17, double %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), double %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Input the radius \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [21 x i8] c"Input the thickness \00"
@.str.3 = [11 x i8] c"gold %f\0A\00"
@.str.4 = [11 x i8] c"silver %f\0A\00"
@.str.5 = [11 x i8] c"copper %f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%9 = load double, double* %1
%10 = load double, double* %2
%11 = call double @price(double 1.324000e+03, double 1.930000e+01, double %9, double %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), double %11)
%13 = load double, double* %1
%14 = load double, double* %2
%15 = call double @price(double 1.776000e+01, double 1.050000e+01, double %13, double %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), double %15)
%17 = load double, double* %1
%18 = load double, double* %2
%19 = call double @price(double 2.211000e-01, double 0x4021DC28F5C28F5C, double %17, double %18)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), double %19)
ret i32 0
}