#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*/ codeln(char *);
int /*<<< orphan*/ popIndent();
int /*<<< orphan*/ pushIndent();
int /*<<< orphan*/ sprintf(char *, char *, double, double, double);
int /*<<< orphan*/ vspace(int);
void outputGainControl() {
  char buf[512];
  vspace(3);
  codeln("void setOutputGain (void *pa, unsigned char uc) {");
  pushIndent();
  codeln("struct b_preamp *pp = (struct b_preamp *) pa;");
  sprintf(buf, "pp->outputGain = %g + ((%g - %g) * (((float) uc) / 127.0));",
          0.1, 10.0, 0.1);
  codeln(buf);
  codeln("printf (\"\\rOUT:%10.4lf\", pp->outputGain);");
  codeln("fflush (stdout);");
  popIndent();
  codeln("}");
  vspace(1);
  codeln("void f"
         "setOutputGain"
         " (void *d, float f) {");
  pushIndent();
  codeln("setOutputGain"
         " (d, (unsigned char)(f*127.0));");
  popIndent();
  codeln("}");
}


x86 assembly (clang, -O0):
<outputGainControl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200,%rsp
mov    $0x3,%edi
call   1050 <vspace@plt>
lea    0xea4(%rip),%rdi
call   1040 <codeln@plt>
mov    $0x0,%al
call   1030 <pushIndent@plt>
lea    0xec3(%rip),%rdi
call   1040 <codeln@plt>
lea    -0x200(%rbp),%rdi
lea    0xede(%rip),%rsi
movsd  0xe66(%rip),%xmm2
movsd  0xe66(%rip),%xmm1
movaps %xmm2,%xmm0
call   1070 <sprintf@plt>
lea    -0x200(%rbp),%rdi
call   1040 <codeln@plt>
lea    0xeef(%rip),%rdi
call   1040 <codeln@plt>
lea    0xf0d(%rip),%rdi
call   1040 <codeln@plt>
mov    $0x0,%al
call   1060 <popIndent@plt>
lea    0xf0b(%rip),%rdi
call   1040 <codeln@plt>
mov    $0x1,%edi
call   1050 <vspace@plt>
lea    0xef7(%rip),%rdi
call   1040 <codeln@plt>
mov    $0x0,%al
call   1030 <pushIndent@plt>
lea    0xf0d(%rip),%rdi
call   1040 <codeln@plt>
mov    $0x0,%al
call   1060 <popIndent@plt>
lea    0xecf(%rip),%rdi
call   1040 <codeln@plt>
add    $0x200,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outputGainControl>:
push   %rbx
sub    $0x200,%rsp
mov    $0x3,%edi
call   1050 <vspace@plt>
lea    0xea7(%rip),%rdi
call   1040 <codeln@plt>
xor    %eax,%eax
call   1030 <pushIndent@plt>
lea    0xec6(%rip),%rdi
call   1040 <codeln@plt>
lea    0xee8(%rip),%rsi
mov    %rsp,%rbx
movsd  0xe6d(%rip),%xmm1
movsd  0xe6d(%rip),%xmm0
mov    %rbx,%rdi
movaps %xmm0,%xmm2
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <codeln@plt>
lea    0xef7(%rip),%rdi
call   1040 <codeln@plt>
lea    0xf15(%rip),%rdi
call   1040 <codeln@plt>
xor    %eax,%eax
call   1060 <popIndent@plt>
lea    0xf13(%rip),%rbx
mov    %rbx,%rdi
call   1040 <codeln@plt>
mov    $0x1,%edi
call   1050 <vspace@plt>
lea    0xefc(%rip),%rdi
call   1040 <codeln@plt>
xor    %eax,%eax
call   1030 <pushIndent@plt>
lea    0xf12(%rip),%rdi
call   1040 <codeln@plt>
xor    %eax,%eax
call   1060 <popIndent@plt>
mov    %rbx,%rdi
call   1040 <codeln@plt>
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"void setOutputGain (void *pa, unsigned char uc) {\00"
@.str.1 = [46 x i8] c"struct b_preamp *pp = (struct b_preamp *) pa;\00"
@.str.2 = [60 x i8] c"pp->outputGain = %g + ((%g - %g) * (((float) uc) / 127.0));\00"
@.str.3 = [42 x i8] c"printf (\22\\rOUT:%10.4lf\22, pp->outputGain);\00"
@.str.4 = [17 x i8] c"fflush (stdout);\00"
@.str.5 = [2 x i8] c"}\00"
@.str.6 = [41 x i8] c"void fsetOutputGain (void *d, float f) {\00"
@.str.7 = [45 x i8] c"setOutputGain (d, (unsigned char)(f*127.0));\00"
define void @outputGainControl() {
%1 = alloca [512 x i8]
%2 = call i32 @vspace(i32 3)
%3 = call i32 @codeln(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @pushIndent()
%5 = call i32 @codeln(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), double 1.000000e-01, double 1.000000e+01, double 1.000000e-01)
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%9 = call i32 @codeln(i8* %8)
%10 = call i32 @codeln(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @codeln(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 (...) @popIndent()
%13 = call i32 @codeln(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @vspace(i32 1)
%15 = call i32 @codeln(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 (...) @pushIndent()
%17 = call i32 @codeln(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 (...) @popIndent()
%19 = call i32 @codeln(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"void setOutputGain (void *pa, unsigned char uc) {\00"
@.str.1 = [46 x i8] c"struct b_preamp *pp = (struct b_preamp *) pa;\00"
@.str.2 = [60 x i8] c"pp->outputGain = %g + ((%g - %g) * (((float) uc) / 127.0));\00"
@.str.3 = [42 x i8] c"printf (\22\\rOUT:%10.4lf\22, pp->outputGain);\00"
@.str.4 = [17 x i8] c"fflush (stdout);\00"
@.str.5 = [2 x i8] c"}\00"
@.str.6 = [41 x i8] c"void fsetOutputGain (void *d, float f) {\00"
@.str.7 = [45 x i8] c"setOutputGain (d, (unsigned char)(f*127.0));\00"
define void @outputGainControl() {
%1 = alloca [512 x i8]
%2 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @vspace(i32 3)
%4 = tail call i32 @codeln(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (...) @pushIndent()
%6 = tail call i32 @codeln(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), double 1.000000e-01, double 1.000000e+01, double 1.000000e-01)
%8 = call i32 @codeln(i8* %2)
%9 = call i32 @codeln(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @codeln(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 (...) @popIndent()
%12 = call i32 @codeln(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 @vspace(i32 1)
%14 = call i32 @codeln(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 (...) @pushIndent()
%16 = call i32 @codeln(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 (...) @popIndent()
%18 = call i32 @codeln(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}