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


x86 assembly (clang, -O0):
<inputGainControl>:
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    0xec2(%rip),%rdi
call   1040 <codeln@plt>
lea    -0x200(%rbp),%rdi
lea    0xedd(%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    0xeed(%rip),%rdi
call   1040 <codeln@plt>
lea    0xf0a(%rip),%rdi
call   1040 <codeln@plt>
mov    $0x0,%al
call   1060 <popIndent@plt>
lea    0xf08(%rip),%rdi
call   1040 <codeln@plt>
mov    $0x1,%edi
call   1050 <vspace@plt>
lea    0xef4(%rip),%rdi
call   1040 <codeln@plt>
mov    $0x0,%al
call   1030 <pushIndent@plt>
lea    0xf09(%rip),%rdi
call   1040 <codeln@plt>
mov    $0x0,%al
call   1060 <popIndent@plt>
lea    0xecc(%rip),%rdi
call   1040 <codeln@plt>
add    $0x200,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputGainControl>:
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    0xec5(%rip),%rdi
call   1040 <codeln@plt>
lea    0xee7(%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    0xef5(%rip),%rdi
call   1040 <codeln@plt>
lea    0xf12(%rip),%rdi
call   1040 <codeln@plt>
xor    %eax,%eax
call   1060 <popIndent@plt>
lea    0xf10(%rip),%rbx
mov    %rbx,%rdi
call   1040 <codeln@plt>
mov    $0x1,%edi
call   1050 <vspace@plt>
lea    0xef9(%rip),%rdi
call   1040 <codeln@plt>
xor    %eax,%eax
call   1030 <pushIndent@plt>
lea    0xf0e(%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 = [49 x i8] c"void setInputGain (void *pa, unsigned char uc) {\00"
@.str.1 = [46 x i8] c"struct b_preamp *pp = (struct b_preamp *) pa;\00"
@.str.2 = [59 x i8] c"pp->inputGain = %g + ((%g - %g) * (((float) uc) / 127.0));\00"
@.str.3 = [41 x i8] c"printf (\22\\rINP:%10.4lf\22, pp->inputGain);\00"
@.str.4 = [17 x i8] c"fflush (stdout);\00"
@.str.5 = [2 x i8] c"}\00"
@.str.6 = [40 x i8] c"void fsetInputGain (void *d, float f) {\00"
@.str.7 = [44 x i8] c"setInputGain (d, (unsigned char)(f*127.0));\00"
define void @inputGainControl() {
%1 = alloca [512 x i8]
%2 = call i32 @vspace(i32 3)
%3 = call i32 @codeln(i8* getelementptr inbounds ([49 x i8], [49 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 ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), double 1.000000e-03, double 1.000000e+01, double 1.000000e-03)
%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 ([41 x i8], [41 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 ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 (...) @pushIndent()
%17 = call i32 @codeln(i8* getelementptr inbounds ([44 x i8], [44 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 = [49 x i8] c"void setInputGain (void *pa, unsigned char uc) {\00"
@.str.1 = [46 x i8] c"struct b_preamp *pp = (struct b_preamp *) pa;\00"
@.str.2 = [59 x i8] c"pp->inputGain = %g + ((%g - %g) * (((float) uc) / 127.0));\00"
@.str.3 = [41 x i8] c"printf (\22\\rINP:%10.4lf\22, pp->inputGain);\00"
@.str.4 = [17 x i8] c"fflush (stdout);\00"
@.str.5 = [2 x i8] c"}\00"
@.str.6 = [40 x i8] c"void fsetInputGain (void *d, float f) {\00"
@.str.7 = [44 x i8] c"setInputGain (d, (unsigned char)(f*127.0));\00"
define void @inputGainControl() {
%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 ([49 x i8], [49 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 ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), double 1.000000e-03, double 1.000000e+01, double 1.000000e-03)
%8 = call i32 @codeln(i8* %2)
%9 = call i32 @codeln(i8* getelementptr inbounds ([41 x i8], [41 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 ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 (...) @pushIndent()
%16 = call i32 @codeln(i8* getelementptr inbounds ([44 x i8], [44 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
}