#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 */
struct annoRow {
  int dummy;
};
typedef int /*<<< orphan*/ avgStr;

/* Variables and functions */
char *cloneString(char *);
char **needLargeZeroedMem(int);
int /*<<< orphan*/ safef(char *, int, char *, double);
double wigRowAvg(struct annoRow *);
char **wordsFromWigRowAvg(struct annoRow *row) {
  double avg = wigRowAvg(row);
  char **words;
  (words = needLargeZeroedMem(sizeof(*words) * (1)));
  char avgStr[32];
  safef(avgStr, sizeof(avgStr), "%lf", avg);
  words[0] = cloneString(avgStr);
  return words;
}


x86 assembly (clang, -O0):
<wordsFromWigRowAvg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <wigRowAvg@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0x8,%edi
call   1060 <needLargeZeroedMem@plt>
mov    %rax,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
mov    $0x20,%esi
lea    0xe83(%rip),%rdx
call   1050 <safef@plt>
lea    -0x40(%rbp),%rdi
call   1030 <cloneString@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wordsFromWigRowAvg>:
push   %r14
push   %rbx
sub    $0x38,%rsp
call   1040 <wigRowAvg@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x8,%edi
call   1060 <needLargeZeroedMem@plt>
mov    %rax,%rbx
lea    0xe9a(%rip),%rdx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x20,%esi
movsd  0x8(%rsp),%xmm0
call   1050 <safef@plt>
mov    %r14,%rdi
call   1030 <cloneString@plt>
mov    %rax,(%rbx)
mov    %rbx,%rax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.annoRow = type { i32 }
@.str = [4 x i8] c"%lf\00"
define i8** @wordsFromWigRowAvg(%struct.annoRow* %0) {
%2 = alloca %struct.annoRow*
%3 = alloca double
%4 = alloca i8**
%5 = alloca [32 x i8]
store %struct.annoRow* %0, %struct.annoRow** %2
%6 = load %struct.annoRow*, %struct.annoRow** %2
%7 = call double @wigRowAvg(%struct.annoRow* %6)
store double %7, double* %3
%8 = call i8** @needLargeZeroedMem(i32 8)
store i8** %8, i8*** %4
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%10 = load double, double* %3
%11 = call i32 @safef(i8* %9, i32 32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %10)
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%13 = call i8* @cloneString(i8* %12)
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 0
store i8* %13, i8** %15
%16 = load i8**, i8*** %4
ret i8** %16
}

LLVM IR (-O2):
%struct.annoRow = type { i32 }
@.str = [4 x i8] c"%lf\00"
define i8** @wordsFromWigRowAvg(%struct.annoRow* %0) {
%2 = alloca [32 x i8]
%3 = tail call double @wigRowAvg(%struct.annoRow* %0)
%4 = tail call i8** @needLargeZeroedMem(i32 8)
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%6 = call i32 @safef(i8* %5, i32 32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %3)
%7 = call i8* @cloneString(i8* %5)
store i8* %7, i8** %4
ret i8** %4
}