#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 /*<<< orphan*/ inttooct(long double, char *);
int /*<<< orphan*/ inttooctfloatpart(long double, char *, int);
char *malloc(int);
int /*<<< orphan*/ memset(char *, char, int);
long double modfl(long double, long double *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void floattooctfloat(long double int_to_oct, char *oct_str) {
  long double int_part = 0.0;
  long double float_part = 0.0;
  float_part = modfl(int_to_oct, &int_part);
  char *int_part_str_oct = malloc(128);
  char *float_part_str_oct = malloc(128);
  memset(int_part_str_oct, '\0', 128);
  memset(float_part_str_oct, '\0', 128);
  inttooct(int_part, int_part_str_oct);
  inttooctfloatpart(float_part, float_part_str_oct, 127);
  memset(oct_str, '\0', 128);
  if ((int_to_oct < 0) && (int_part_str_oct[0] != '-')) {
    strcpy(oct_str, "-");
  }
  strcat(oct_str, int_part_str_oct);
  strcat(oct_str, ".");
  strcat(oct_str, float_part_str_oct);
}


x86 assembly (clang, -O0):
<floattooctfloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %rdi,-0x18(%rbp)
fldz
fld    %st(0)
fstpt  -0x5c(%rbp)
fld    %st(0)
fstpt  -0x30(%rbp)
fstpt  -0x40(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    -0x30(%rbp),%rdi
call   1060 <modfl@plt>
fstpt  -0x40(%rbp)
mov    $0x80,%edi
mov    %edi,-0x60(%rbp)
call   1080 <malloc@plt>
mov    -0x60(%rbp),%edi
mov    %rax,-0x48(%rbp)
call   1080 <malloc@plt>
mov    -0x60(%rbp),%edx
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rdi
xor    %esi,%esi
mov    %esi,-0x64(%rbp)
call   1050 <memset@plt>
mov    -0x64(%rbp),%esi
mov    -0x60(%rbp),%edx
mov    -0x50(%rbp),%rdi
call   1050 <memset@plt>
fldt   -0x30(%rbp)
mov    -0x48(%rbp),%rdi
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <inttooct@plt>
fldt   -0x40(%rbp)
mov    -0x50(%rbp),%rdi
mov    %rsp,%rax
fstpt  (%rax)
mov    $0x7f,%esi
call   1070 <inttooctfloatpart@plt>
mov    -0x64(%rbp),%esi
mov    -0x60(%rbp),%edx
mov    -0x18(%rbp),%rdi
call   1050 <memset@plt>
fldt   -0x5c(%rbp)
fldt   -0x10(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    1252 <floattooctfloat+0xe2>
jmp    1232 <floattooctfloat+0xc2>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     1252 <floattooctfloat+0xe2>
mov    -0x18(%rbp),%rdi
lea    0xdb3(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1090 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xd98(%rip),%rsi
call   1090 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x50(%rbp),%rsi
call   1090 <strcat@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floattooctfloat>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdi,%r15
fldt   0x70(%rsp)
fld    %st(0)
fstpt  0x28(%rsp)
fldz
fld    %st(0)
fstpt  0x34(%rsp)
fstpt  0x40(%rsp)
fstpt  (%rsp)
lea    0x40(%rsp),%rdi
call   1060 <modfl@plt>
fstpt  0x1c(%rsp)
mov    $0x80,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    $0x80,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
fldt   0x40(%rsp)
fstpt  (%rsp)
mov    %rbx,%rdi
call   1040 <inttooct@plt>
fldt   0x1c(%rsp)
fstpt  (%rsp)
mov    %r14,%rdi
mov    $0x7f,%esi
call   1070 <inttooctfloatpart@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
fldt   0x34(%rsp)
fldt   0x28(%rsp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    1231 <floattooctfloat+0xc1>
cmpb   $0x2d,(%rbx)
je     1231 <floattooctfloat+0xc1>
lea    0xdd7(%rip),%rsi
mov    %r15,%rdi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1090 <strcat@plt>
lea    0xdbf(%rip),%rsi
mov    %r15,%rdi
call   1090 <strcat@plt>
mov    %r15,%rdi
mov    %r14,%rsi
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1090 <strcat@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c".\00"
define void @floattooctfloat(x86_fp80 %0, i8* %1) {
%3 = alloca x86_fp80
%4 = alloca i8*
%5 = alloca x86_fp80
%6 = alloca x86_fp80
%7 = alloca i8*
%8 = alloca i8*
store x86_fp80 %0, x86_fp80* %3
store i8* %1, i8** %4
store x86_fp80 0xK00000000000000000000, x86_fp80* %5
store x86_fp80 0xK00000000000000000000, x86_fp80* %6
%9 = load x86_fp80, x86_fp80* %3
%10 = call x86_fp80 @modfl(x86_fp80 %9, x86_fp80* %5)
store x86_fp80 %10, x86_fp80* %6
%11 = call i8* @malloc(i32 128)
store i8* %11, i8** %7
%12 = call i8* @malloc(i32 128)
store i8* %12, i8** %8
%13 = load i8*, i8** %7
%14 = call i32 @memset(i8* %13, i8 signext 0, i32 128)
%15 = load i8*, i8** %8
%16 = call i32 @memset(i8* %15, i8 signext 0, i32 128)
%17 = load x86_fp80, x86_fp80* %5
%18 = load i8*, i8** %7
%19 = call i32 @inttooct(x86_fp80 %17, i8* %18)
%20 = load x86_fp80, x86_fp80* %6
%21 = load i8*, i8** %8
%22 = call i32 @inttooctfloatpart(x86_fp80 %20, i8* %21, i32 127)
%23 = load i8*, i8** %4
%24 = call i32 @memset(i8* %23, i8 signext 0, i32 128)
%25 = load x86_fp80, x86_fp80* %3
%26 = fcmp olt x86_fp80 %25, 0xK00000000000000000000
br i1 %26, label %27, label %36
27: ; preds = %2
%28 = load i8*, i8** %7
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 45
br i1 %32, label %33, label %36
33: ; preds = %27
%34 = load i8*, i8** %4
%35 = call i32 @strcpy(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %36
36: ; preds = %33, %27, %2
%37 = load i8*, i8** %4
%38 = load i8*, i8** %7
%39 = call i32 @strcat(i8* %37, i8* %38)
%40 = load i8*, i8** %4
%41 = call i32 @strcat(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%42 = load i8*, i8** %4
%43 = load i8*, i8** %8
%44 = call i32 @strcat(i8* %42, i8* %43)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c".\00"
define void @floattooctfloat(x86_fp80 %0, i8* %1) {
%3 = alloca x86_fp80
%4 = bitcast x86_fp80* %3 to i8*
store x86_fp80 0xK00000000000000000000, x86_fp80* %3
%5 = call x86_fp80 @modfl(x86_fp80 %0, x86_fp80* %3)
%6 = tail call dereferenceable_or_null(128) i8* @malloc(i32 128)
%7 = tail call dereferenceable_or_null(128) i8* @malloc(i32 128)
%8 = tail call i32 @memset(i8* %6, i8 signext 0, i32 128)
%9 = tail call i32 @memset(i8* %7, i8 signext 0, i32 128)
%10 = load x86_fp80, x86_fp80* %3
%11 = tail call i32 @inttooct(x86_fp80 %10, i8* %6)
%12 = tail call i32 @inttooctfloatpart(x86_fp80 %5, i8* %7, i32 127)
%13 = tail call i32 @memset(i8* %1, i8 signext 0, i32 128)
%14 = fcmp olt x86_fp80 %0, 0xK00000000000000000000
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i8, i8* %6
%17 = icmp eq i8 %16, 45
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %15, %2
%21 = tail call i32 @strcat(i8* %1, i8* %6)
%22 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = tail call i32 @strcat(i8* %1, i8* %7)
ret void
}