#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 */
long long atoll(char *);
int /*<<< orphan*/ printf(char *, long double);
long double sqrtl(long double);
int main(int argc, char **argv) {
  long long int ram;
  long int divider;
  long double n;
  long double jn;
  double mem_percent = .94;
  ;
  ram = atoll(argv[1]);
  ram = ram - 1024 * 512;
  ;
  ram = ram * 1024 * .94;
  ;
  n = (long double)ram / 8;
  n = sqrtl(n);
  divider = (int)n / 128;
  n = divider * 128;
  printf("%.0Lf\n", n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0x3fee147ae147ae14,%rax
14 ee 3f
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoll@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0xfffffffffff80000,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0xa,%rax
cvtsi2sd %rax,%xmm0
movsd  0xe7c(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x60(%rbp)
fildll -0x60(%rbp)
flds   0xe66(%rip)
fdivrp %st,%st(1)
fstpt  -0x30(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <sqrtl@plt>
fstpt  -0x30(%rbp)
fldt   -0x30(%rbp)
fnstcw -0x62(%rbp)
movzwl -0x62(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x64(%rbp)
fldcw  -0x64(%rbp)
fistpl -0x54(%rbp)
fldcw  -0x62(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,%ecx
add    $0x7f,%ecx
test   %eax,%eax
cmovs  %ecx,%eax
sar    $0x7,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
shl    $0x7,%rax
mov    %rax,-0x50(%rbp)
fildll -0x50(%rbp)
fstpt  -0x30(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe02(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0x8(%rsi),%rdi
call   1040 <atoll@plt>
shl    $0xa,%rax
add    $0xffffffffe0000000,%rax
cvtsi2sd %rax,%xmm0
mulsd  0xeac(%rip),%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,0x18(%rsp)
fildll 0x18(%rsp)
fmuls  0xea0(%rip)
fstpt  (%rsp)
call   1050 <sqrtl@plt>
fnstcw 0x10(%rsp)
movzwl 0x10(%rsp),%eax
or     $0xc00,%eax
mov    %ax,0x12(%rsp)
fldcw  0x12(%rsp)
fistpl 0x14(%rsp)
fldcw  0x10(%rsp)
mov    0x14(%rsp),%eax
lea    0x7f(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x7,%ecx
movslq %ecx,%rax
shl    $0x7,%rax
mov    %rax,0x20(%rsp)
fildll 0x20(%rsp)
fstpt  (%rsp)
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%.0Lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i64
%6 = alloca i64
%7 = alloca x86_fp80
%8 = alloca x86_fp80
%9 = alloca double
store i32 %0, i32* %3
store i8** %1, i8*** %4
store double 0x3FEE147AE147AE14, double* %9
%10 = load i8**, i8*** %4
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @atoll(i8* %12)
store i64 %13, i64* %5
%14 = load i64, i64* %5
%15 = sub nsw i64 %14, 524288
store i64 %15, i64* %5
%16 = load i64, i64* %5
%17 = mul nsw i64 %16, 1024
%18 = sitofp i64 %17 to double
%19 = fmul double %18, 0x3FEE147AE147AE14
%20 = fptosi double %19 to i64
store i64 %20, i64* %5
%21 = load i64, i64* %5
%22 = sitofp i64 %21 to x86_fp80
%23 = fdiv x86_fp80 %22, 0xK40028000000000000000
store x86_fp80 %23, x86_fp80* %7
%24 = load x86_fp80, x86_fp80* %7
%25 = call x86_fp80 @sqrtl(x86_fp80 %24)
store x86_fp80 %25, x86_fp80* %7
%26 = load x86_fp80, x86_fp80* %7
%27 = fptosi x86_fp80 %26 to i32
%28 = sdiv i32 %27, 128
%29 = sext i32 %28 to i64
store i64 %29, i64* %6
%30 = load i64, i64* %6
%31 = mul nsw i64 %30, 128
%32 = sitofp i64 %31 to x86_fp80
store x86_fp80 %32, x86_fp80* %7
%33 = load x86_fp80, x86_fp80* %7
%34 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), x86_fp80 %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%.0Lf\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @atoll(i8* %4)
%6 = shl i64 %5, 10
%7 = add i64 %6, -536870912
%8 = sitofp i64 %7 to double
%9 = fmul double %8, 0x3FEE147AE147AE14
%10 = fptosi double %9 to i64
%11 = sitofp i64 %10 to x86_fp80
%12 = fmul x86_fp80 %11, 0xK3FFC8000000000000000
%13 = tail call x86_fp80 @sqrtl(x86_fp80 %12)
%14 = fptosi x86_fp80 %13 to i32
%15 = sdiv i32 %14, 128
%16 = sext i32 %15 to i64
%17 = shl nsw i64 %16, 7
%18 = sitofp i64 %17 to x86_fp80
%19 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), x86_fp80 %18)
ret i32 0
}