#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*/ eputc(int);
void single_note_tuning_change(int key, float midipitch) {
  unsigned char kk, xx, yy, zz;
  int number, intfraction;
  float fraction;
  eputc(0);
  eputc(0xf0);
  eputc(11);
  eputc(127);
  eputc(0);
  eputc(8);
  eputc(2);
  eputc(0);
  eputc(1);
  kk = (unsigned char)127 & key;
  eputc(kk);
  number = (int)midipitch;
  fraction = midipitch - (float)number;
  if (fraction < 0.0)
    fraction = -fraction;
  intfraction = fraction * 16384;
  xx = 0x7f & number;
  yy = intfraction / 128;
  zz = intfraction % 128;
  yy = 0x7f & yy;
  zz = 0x7f & zz;
  eputc(xx);
  eputc(yy);
  eputc(zz);
  eputc(247);
}


x86 assembly (clang, -O0):
<single_note_tuning_change>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
xor    %edi,%edi
call   1030 <eputc@plt>
mov    $0xf0,%edi
call   1030 <eputc@plt>
mov    $0xb,%edi
call   1030 <eputc@plt>
mov    $0x7f,%edi
call   1030 <eputc@plt>
xor    %edi,%edi
call   1030 <eputc@plt>
mov    $0x8,%edi
call   1030 <eputc@plt>
mov    $0x2,%edi
call   1030 <eputc@plt>
xor    %edi,%edi
call   1030 <eputc@plt>
mov    $0x1,%edi
call   1030 <eputc@plt>
mov    -0x4(%rbp),%eax
and    $0x7f,%eax
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%edi
call   1030 <eputc@plt>
cvttss2si -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    11cb <single_note_tuning_change+0xbb>
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xe2d(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
and    $0x7f,%eax
mov    %al,-0xa(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x80,%ecx
cltd
idiv   %ecx
mov    %al,-0xb(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x80,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0xc(%rbp)
movzbl -0xb(%rbp),%eax
and    $0x7f,%eax
mov    %al,-0xb(%rbp)
movzbl -0xc(%rbp),%eax
and    $0x7f,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%edi
call   1030 <eputc@plt>
movzbl -0xb(%rbp),%edi
call   1030 <eputc@plt>
movzbl -0xc(%rbp),%edi
call   1030 <eputc@plt>
mov    $0xf7,%edi
call   1030 <eputc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<single_note_tuning_change>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movaps %xmm0,(%rsp)
mov    %edi,%ebx
xor    %edi,%edi
call   1030 <eputc@plt>
mov    $0xf0,%edi
call   1030 <eputc@plt>
mov    $0xb,%edi
call   1030 <eputc@plt>
mov    $0x7f,%edi
call   1030 <eputc@plt>
xor    %edi,%edi
call   1030 <eputc@plt>
mov    $0x8,%edi
call   1030 <eputc@plt>
mov    $0x2,%edi
call   1030 <eputc@plt>
xor    %edi,%edi
call   1030 <eputc@plt>
mov    $0x1,%edi
call   1030 <eputc@plt>
and    $0x7f,%ebx
mov    %ebx,%edi
call   1030 <eputc@plt>
movaps (%rsp),%xmm3
cvttss2si %xmm3,%edi
cvttps2dq %xmm3,%xmm0
cvtdq2ps %xmm0,%xmm0
subss  %xmm0,%xmm3
movaps 0xe6f(%rip),%xmm0
xorps  %xmm3,%xmm0
xorps  %xmm1,%xmm1
movaps %xmm3,%xmm2
cmpltss %xmm1,%xmm2
andps  %xmm2,%xmm0
andnps %xmm3,%xmm2
orps   %xmm0,%xmm2
mulss  0xe60(%rip),%xmm2
cvttss2si %xmm2,%ebx
and    $0x7f,%edi
lea    0x7f(%rbx),%ebp
test   %ebx,%ebx
cmovns %ebx,%ebp
shr    $0x7,%ebp
and    $0x7f,%ebp
and    $0x7f,%ebx
call   1030 <eputc@plt>
mov    %ebp,%edi
call   1030 <eputc@plt>
mov    %ebx,%edi
call   1030 <eputc@plt>
mov    $0xf7,%edi
add    $0x18,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <eputc@plt>

LLVM IR (-O0):
define void @single_note_tuning_change(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca float
store i32 %0, i32* %3
store float %1, float* %4
%12 = call i32 @eputc(i32 0)
%13 = call i32 @eputc(i32 240)
%14 = call i32 @eputc(i32 11)
%15 = call i32 @eputc(i32 127)
%16 = call i32 @eputc(i32 0)
%17 = call i32 @eputc(i32 8)
%18 = call i32 @eputc(i32 2)
%19 = call i32 @eputc(i32 0)
%20 = call i32 @eputc(i32 1)
%21 = load i32, i32* %3
%22 = and i32 127, %21
%23 = trunc i32 %22 to i8
store i8 %23, i8* %5
%24 = load i8, i8* %5
%25 = zext i8 %24 to i32
%26 = call i32 @eputc(i32 %25)
%27 = load float, float* %4
%28 = fptosi float %27 to i32
store i32 %28, i32* %9
%29 = load float, float* %4
%30 = load i32, i32* %9
%31 = sitofp i32 %30 to float
%32 = fsub float %29, %31
store float %32, float* %11
%33 = load float, float* %11
%34 = fpext float %33 to double
%35 = fcmp olt double %34, 0.000000e+00
br i1 %35, label %36, label %39
36: ; preds = %2
%37 = load float, float* %11
%38 = fneg float %37
store float %38, float* %11
br label %39
39: ; preds = %36, %2
%40 = load float, float* %11
%41 = fmul float %40, 1.638400e+04
%42 = fptosi float %41 to i32
store i32 %42, i32* %10
%43 = load i32, i32* %9
%44 = and i32 127, %43
%45 = trunc i32 %44 to i8
store i8 %45, i8* %6
%46 = load i32, i32* %10
%47 = sdiv i32 %46, 128
%48 = trunc i32 %47 to i8
store i8 %48, i8* %7
%49 = load i32, i32* %10
%50 = srem i32 %49, 128
%51 = trunc i32 %50 to i8
store i8 %51, i8* %8
%52 = load i8, i8* %7
%53 = zext i8 %52 to i32
%54 = and i32 127, %53
%55 = trunc i32 %54 to i8
store i8 %55, i8* %7
%56 = load i8, i8* %8
%57 = zext i8 %56 to i32
%58 = and i32 127, %57
%59 = trunc i32 %58 to i8
store i8 %59, i8* %8
%60 = load i8, i8* %6
%61 = zext i8 %60 to i32
%62 = call i32 @eputc(i32 %61)
%63 = load i8, i8* %7
%64 = zext i8 %63 to i32
%65 = call i32 @eputc(i32 %64)
%66 = load i8, i8* %8
%67 = zext i8 %66 to i32
%68 = call i32 @eputc(i32 %67)
%69 = call i32 @eputc(i32 247)
ret void
}

LLVM IR (-O2):
define void @single_note_tuning_change(i32 %0, float %1) {
%3 = tail call i32 @eputc(i32 0)
%4 = tail call i32 @eputc(i32 240)
%5 = tail call i32 @eputc(i32 11)
%6 = tail call i32 @eputc(i32 127)
%7 = tail call i32 @eputc(i32 0)
%8 = tail call i32 @eputc(i32 8)
%9 = tail call i32 @eputc(i32 2)
%10 = tail call i32 @eputc(i32 0)
%11 = tail call i32 @eputc(i32 1)
%12 = and i32 %0, 127
%13 = tail call i32 @eputc(i32 %12)
%14 = fptosi float %1 to i32
%15 = sitofp i32 %14 to float
%16 = fsub float %1, %15
%17 = fcmp olt float %16, 0.000000e+00
%18 = fneg float %16
%19 = select i1 %17, float %18, float %16
%20 = fmul float %19, 1.638400e+04
%21 = fptosi float %20 to i32
%22 = and i32 %14, 127
%23 = sdiv i32 %21, 128
%24 = and i32 %23, 127
%25 = and i32 %21, 127
%26 = tail call i32 @eputc(i32 %22)
%27 = tail call i32 @eputc(i32 %24)
%28 = tail call i32 @eputc(i32 %25)
%29 = tail call i32 @eputc(i32 247)
ret void
}