#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int floorl(long double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, long double,
                           long double);
int sqrtl(int);
void print_double(void *elem, void *fileout) {
  long double k, i, j;
  long double x;
  k = *((long double *)elem);
  x = (1 + sqrtl(1 + 8 * (k - 1))) / 2;
  i = floorl(x) + 1;
  j = k - ((i - 1) * 1.0 * (i - 2)) / 2;
  fprintf((FILE *)fileout, "%0.0Lf %0.0Lf\n", i - 1, j - 1);
}


x86 assembly (clang, -O0):
<print_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
fldt   (%rax)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
fld1
fld    %st(0)
fstpt  -0x6c(%rbp)
fsubr  %st,%st(1)
flds   0xea2(%rip)
fmulp  %st,%st(2)
faddp  %st,%st(1)
fnstcw -0x5e(%rbp)
movzwl -0x5e(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x60(%rbp)
fldcw  -0x60(%rbp)
fistpl -0x5c(%rbp)
fldcw  -0x5e(%rbp)
mov    -0x5c(%rbp),%edi
call   1040 <sqrtl@plt>
mov    %eax,%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %ecx,%eax
shr    $0x1f,%edx
mov    %edx,%ecx
lea    0x1(%rax,%rcx,1),%eax
sar    %eax
mov    %eax,-0x58(%rbp)
fildl  -0x58(%rbp)
fstpt  -0x50(%rbp)
fldt   -0x50(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <floorl@plt>
fldt   -0x6c(%rbp)
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
fildl  -0x54(%rbp)
fstpt  -0x30(%rbp)
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fld    %st(0)
fsub   %st(3),%st
flds   0xe38(%rip)
fsubr  %st,%st(2)
fxch   %st(1)
fmulp  %st,%st(2)
fdivrp %st,%st(1)
fsubrp %st,%st(1)
fstpt  -0x40(%rbp)
mov    -0x10(%rbp),%rdi
fldt   -0x30(%rbp)
fsub   %st(1),%st
fldt   -0x40(%rbp)
fsubp  %st,%st(2)
mov    %rsp,%rax
fxch   %st(1)
fstpt  0x10(%rax)
fstpt  (%rax)
lea    0xe10(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_double>:
push   %rbx
sub    $0x50,%rsp
fldt   (%rdi)
fld    %st(0)
fstpt  0x44(%rsp)
fld1
fld    %st(0)
fchs
fld    %st(0)
fstpt  0x38(%rsp)
faddp  %st,%st(2)
fxch   %st(1)
fmuls  0xead(%rip)
faddp  %st,%st(1)
fnstcw 0x28(%rsp)
movzwl 0x28(%rsp),%eax
or     $0xc00,%eax
mov    %ax,0x2a(%rsp)
fldcw  0x2a(%rsp)
fistpl 0x2c(%rsp)
fldcw  0x28(%rsp)
mov    %rsi,%rbx
mov    0x2c(%rsp),%edi
call   1040 <sqrtl@plt>
mov    %eax,%ecx
add    $0x1,%ecx
shr    $0x1f,%ecx
add    %ecx,%eax
add    $0x1,%eax
sar    %eax
mov    %eax,0x30(%rsp)
fildl  0x30(%rsp)
fstpt  (%rsp)
call   1050 <floorl@plt>
add    $0x1,%eax
mov    %eax,0x34(%rsp)
fildl  0x34(%rsp)
fldt   0x38(%rsp)
fld    %st(1)
fadd   %st(1),%st
fxch   %st(2)
fadds  0xe4a(%rip)
fmul   %st(2),%st
fmuls  0xe46(%rip)
fldt   0x44(%rsp)
faddp  %st,%st(1)
faddp  %st,%st(1)
fxch   %st(1)
fstpt  (%rsp)
fstpt  0x10(%rsp)
lea    0xe32(%rip),%rsi
mov    %rbx,%rdi
call   1030 <fprintf@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%0.0Lf %0.0Lf\0A\00"
define void @print_double(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca x86_fp80
%6 = alloca x86_fp80
%7 = alloca x86_fp80
%8 = alloca x86_fp80
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = bitcast i8* %9 to x86_fp80*
%11 = load x86_fp80, x86_fp80* %10
store x86_fp80 %11, x86_fp80* %5
%12 = load x86_fp80, x86_fp80* %5
%13 = fsub x86_fp80 %12, 0xK3FFF8000000000000000
%14 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 0xK40028000000000000000, x86_fp80 %13, x86_fp80 0xK3FFF8000000000000000)
%15 = fptosi x86_fp80 %14 to i32
%16 = call i32 @sqrtl(i32 %15)
%17 = add nsw i32 1, %16
%18 = sdiv i32 %17, 2
%19 = sitofp i32 %18 to x86_fp80
store x86_fp80 %19, x86_fp80* %8
%20 = load x86_fp80, x86_fp80* %8
%21 = call i32 @floorl(x86_fp80 %20)
%22 = add nsw i32 %21, 1
%23 = sitofp i32 %22 to x86_fp80
store x86_fp80 %23, x86_fp80* %6
%24 = load x86_fp80, x86_fp80* %5
%25 = load x86_fp80, x86_fp80* %6
%26 = fsub x86_fp80 %25, 0xK3FFF8000000000000000
%27 = fmul x86_fp80 %26, 0xK3FFF8000000000000000
%28 = load x86_fp80, x86_fp80* %6
%29 = fsub x86_fp80 %28, 0xK40008000000000000000
%30 = fmul x86_fp80 %27, %29
%31 = fdiv x86_fp80 %30, 0xK40008000000000000000
%32 = fsub x86_fp80 %24, %31
store x86_fp80 %32, x86_fp80* %7
%33 = load i8*, i8** %4
%34 = bitcast i8* %33 to i32*
%35 = load x86_fp80, x86_fp80* %6
%36 = fsub x86_fp80 %35, 0xK3FFF8000000000000000
%37 = load x86_fp80, x86_fp80* %7
%38 = fsub x86_fp80 %37, 0xK3FFF8000000000000000
%39 = call i32 @fprintf(i32* %34, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), x86_fp80 %36, x86_fp80 %38)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%0.0Lf %0.0Lf\0A\00"
define void @print_double(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to x86_fp80*
%4 = load x86_fp80, x86_fp80* %3
%5 = fadd x86_fp80 %4, 0xKBFFF8000000000000000
%6 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %5, x86_fp80 0xK40028000000000000000, x86_fp80 0xK3FFF8000000000000000)
%7 = fptosi x86_fp80 %6 to i32
%8 = tail call i32 @sqrtl(i32 %7)
%9 = add nsw i32 %8, 1
%10 = sdiv i32 %9, 2
%11 = sitofp i32 %10 to x86_fp80
%12 = tail call i32 @floorl(x86_fp80 %11)
%13 = add nsw i32 %12, 1
%14 = sitofp i32 %13 to x86_fp80
%15 = fadd x86_fp80 %14, 0xKBFFF8000000000000000
%16 = fadd x86_fp80 %14, 0xKC0008000000000000000
%17 = fmul x86_fp80 %15, %16
%18 = fmul x86_fp80 %17, 0xK3FFE8000000000000000
%19 = fsub x86_fp80 %4, %18
%20 = bitcast i8* %1 to i32*
%21 = fadd x86_fp80 %19, 0xKBFFF8000000000000000
%22 = tail call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), x86_fp80 %15, x86_fp80 %21)
ret void
}