#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 BUFSIZ;
float fabs(float);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
float sqrt(float);
int /*<<< orphan*/ sscanf(char *, char *, float *);
int /*<<< orphan*/ stdin;
int main() {
  char line[BUFSIZ];
  float q, a, b, r, emin;
  float mass;
  float ion;
  printf("the charge\n");
  fgets(line, 80, stdin);
  sscanf(line, "%f", &q);
  printf(" the radius\n");
  fgets(line, 80, stdin);
  sscanf(line, "%f", &r);
  printf(" the potential depth\n");
  fgets(line, 80, stdin);
  sscanf(line, "%f", &emin);
  emin = fabs(emin);
  printf(" the ion mass\n");
  fgets(line, 80, stdin);
  sscanf(line, "%f", &mass);
  r = r * r * r;
  r *= r;
  a = sqrt(2. * emin * r);
  b = sqrt(emin * r * r);
  printf("atom 0 0 0 myserial uber.ion %f %f %f %f;\n", q, a, b, mass);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x2e79(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x10(%rbp)
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    0x2e4b(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1040 <fgets@plt>
mov    -0x38(%rbp),%rdi
lea    0xe60(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1060 <sscanf@plt>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    0x2e12(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1040 <fgets@plt>
mov    -0x38(%rbp),%rdi
lea    0xe27(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1060 <sscanf@plt>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    0x2dd9(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1040 <fgets@plt>
mov    -0x38(%rbp),%rdi
lea    0xdee(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1060 <sscanf@plt>
movss  -0x24(%rbp),%xmm0
call   1050 <fabs@plt>
movss  %xmm0,-0x24(%rbp)
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    0x2d91(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1040 <fgets@plt>
mov    -0x38(%rbp),%rdi
lea    0xda6(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1060 <sscanf@plt>
movss  -0x20(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd55(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1070 <sqrt@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x24(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
call   1070 <sqrt@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x1c(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x28(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xd3b(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2e74(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e5e(%rip),%r15
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <fgets@plt>
lea    0xe6f(%rip),%r14
lea    -0x2c(%rbp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <sscanf@plt>
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <fgets@plt>
lea    -0x20(%rbp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <sscanf@plt>
lea    0xe73(%rip),%rdi
call   1030 <puts@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <fgets@plt>
lea    -0x1c(%rbp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <sscanf@plt>
movss  -0x1c(%rbp),%xmm0
andps  0xdee(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xe4c(%rip),%rdi
call   1030 <puts@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <fgets@plt>
lea    -0x28(%rbp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <sscanf@plt>
movss  -0x20(%rbp),%xmm0
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm1,%xmm1
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm2
mulsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
movss  %xmm1,-0x20(%rbp)
xorps  %xmm3,%xmm3
ucomiss %xmm3,%xmm0
jb     1288 <main+0x138>
xorps  %xmm2,%xmm2
sqrtss %xmm0,%xmm2
jmp    1293 <main+0x143>
call   1070 <sqrt@plt>
xorps  %xmm3,%xmm3
movaps %xmm0,%xmm2
movss  -0x20(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
ucomiss %xmm3,%xmm0
jb     12b0 <main+0x160>
sqrtss %xmm0,%xmm0
jmp    12bf <main+0x16f>
movss  %xmm2,-0x24(%rbp)
call   1070 <sqrt@plt>
movss  -0x24(%rbp),%xmm2
movss  -0x2c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm4
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
movss  -0x28(%rbp),%xmm0
xorps  %xmm3,%xmm3
cvtss2sd %xmm0,%xmm3
lea    0xd2a(%rip),%rdi
movaps %xmm4,%xmm0
mov    $0x4,%al
call   1040 <printf@plt>
xor    %eax,%eax
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [12 x i8] c"the charge\0A\00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [13 x i8] c" the radius\0A\00"
@.str.3 = [22 x i8] c" the potential depth\0A\00"
@.str.4 = [15 x i8] c" the ion mass\0A\00"
@.str.5 = [43 x i8] c"atom 0 0 0 myserial uber.ion %f %f %f %f;\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i64
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = load i32, i32* @BUFSIZ
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %1
%13 = alloca i8, i64 %11
store i64 %11, i64* %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @stdin
%16 = call i32 @fgets(i8* %13, i32 80, i32 %15)
%17 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32, i32* @stdin
%20 = call i32 @fgets(i8* %13, i32 80, i32 %19)
%21 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %6)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%23 = load i32, i32* @stdin
%24 = call i32 @fgets(i8* %13, i32 80, i32 %23)
%25 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %7)
%26 = load float, float* %7
%27 = call float @fabs(float %26)
store float %27, float* %7
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%29 = load i32, i32* @stdin
%30 = call i32 @fgets(i8* %13, i32 80, i32 %29)
%31 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %8)
%32 = load float, float* %6
%33 = load float, float* %6
%34 = fmul float %32, %33
%35 = load float, float* %6
%36 = fmul float %34, %35
store float %36, float* %6
%37 = load float, float* %6
%38 = load float, float* %6
%39 = fmul float %38, %37
store float %39, float* %6
%40 = load float, float* %7
%41 = fpext float %40 to double
%42 = fmul double 2.000000e+00, %41
%43 = load float, float* %6
%44 = fpext float %43 to double
%45 = fmul double %42, %44
%46 = fptrunc double %45 to float
%47 = call float @sqrt(float %46)
store float %47, float* %4
%48 = load float, float* %7
%49 = load float, float* %6
%50 = fmul float %48, %49
%51 = load float, float* %6
%52 = fmul float %50, %51
%53 = call float @sqrt(float %52)
store float %53, float* %5
%54 = load float, float* %3
%55 = fpext float %54 to double
%56 = load float, float* %4
%57 = fpext float %56 to double
%58 = load float, float* %5
%59 = fpext float %58 to double
%60 = load float, float* %8
%61 = fpext float %60 to double
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), double %55, double %57, double %59, double %61)
%63 = load i8*, i8** %1
ret i32 0
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@stdin = global i32 0
@.str.1 = [3 x i8] c"%f\00"
@.str.5 = [43 x i8] c"atom 0 0 0 myserial uber.ion %f %f %f %f;\0A\00"
@str = [11 x i8] c"the charge\00"
@str.6 = [12 x i8] c" the radius\00"
@str.7 = [21 x i8] c" the potential depth\00"
@str.8 = [14 x i8] c" the ion mass\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = load i32, i32* @BUFSIZ
%6 = zext i32 %5 to i64
%7 = alloca i8, i64 %6
%8 = bitcast float* %1 to i8*
%9 = bitcast float* %2 to i8*
%10 = bitcast float* %3 to i8*
%11 = bitcast float* %4 to i8*
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%13 = load i32, i32* @stdin
%14 = call i32 @fgets(i8* %7, i32 80, i32 %13)
%15 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.6, i64 0, i64 0))
%17 = load i32, i32* @stdin
%18 = call i32 @fgets(i8* %7, i32 80, i32 %17)
%19 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.7, i64 0, i64 0))
%21 = load i32, i32* @stdin
%22 = call i32 @fgets(i8* %7, i32 80, i32 %21)
%23 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%24 = load float, float* %3
%25 = call float @llvm.fabs.f32(float %24)
store float %25, float* %3
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.8, i64 0, i64 0))
%27 = load i32, i32* @stdin
%28 = call i32 @fgets(i8* %7, i32 80, i32 %27)
%29 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%30 = load float, float* %2
%31 = fmul float %30, %30
%32 = fmul float %30, %31
%33 = fmul float %32, %32
store float %33, float* %2
%34 = load float, float* %3
%35 = fpext float %34 to double
%36 = fmul double %35, 2.000000e+00
%37 = fpext float %33 to double
%38 = fmul double %36, %37
%39 = fptrunc double %38 to float
%40 = call float @sqrt(float %39)
%41 = load float, float* %3
%42 = load float, float* %2
%43 = fmul float %41, %42
%44 = fmul float %42, %43
%45 = call float @sqrt(float %44)
%46 = load float, float* %1
%47 = fpext float %46 to double
%48 = fpext float %40 to double
%49 = fpext float %45 to double
%50 = load float, float* %4
%51 = fpext float %50 to double
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), double %47, double %48, double %49, double %51)
ret i32 0
}