#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 */
double fabs(double);
double floor(double);
double series(int, int);
unsigned char get_byte(int id) {
  double s1 = series(1, id);
  double s2 = series(4, id);
  double s3 = series(5, id);
  double s4 = series(6, id);
  double pid = 4. * s1 - 2. * s2 - s3 - s4;
  pid = pid - (int)pid + 1.;
  double y = fabs(pid);
  y = 16. * (y - floor(y));
  unsigned char first = y;
  y = 16. * (y - floor(y));
  unsigned char second = y;
  return (first << 4) | second;
}


x86 assembly (clang, -O0):
<get_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
call   1030 <series@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x4,%edi
call   1030 <series@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x5,%edi
call   1030 <series@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x6,%edi
call   1030 <series@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe77(%rip),%xmm2
mulsd  %xmm2,%xmm0
subsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movaps %xmm0,%xmm1
cvttpd2dq %xmm1,%xmm1
cvtdq2pd %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  0xe44(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movaps 0xe4c(%rip),%xmm1
movsd  -0x30(%rbp),%xmm0
pand   %xmm1,%xmm0
movlpd %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
call   1040 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xe0b(%rip),%xmm1
movsd  %xmm1,-0x50(%rbp)
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cvttsd2si -0x38(%rbp),%eax
mov    %al,-0x39(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
call   1040 <floor@plt>
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cvttsd2si -0x38(%rbp),%eax
mov    %al,-0x3a(%rbp)
movzbl -0x39(%rbp),%eax
shl    $0x4,%eax
movzbl -0x3a(%rbp),%ecx
or     %ecx,%eax
movzbl %al,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_byte>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebx
mov    $0x1,%edi
mov    %ebx,%esi
call   1030 <series@plt>
movapd %xmm0,(%rsp)
mov    $0x4,%edi
mov    %ebx,%esi
call   1030 <series@plt>
movsd  %xmm0,0x18(%rsp)
mov    $0x5,%edi
mov    %ebx,%esi
call   1030 <series@plt>
movsd  %xmm0,0x10(%rsp)
mov    $0x6,%edi
mov    %ebx,%esi
call   1030 <series@plt>
movapd (%rsp),%xmm1
mulsd  0xe8b(%rip),%xmm1
movsd  0x18(%rsp),%xmm2
addsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
subsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
cvttpd2dq %xmm1,%xmm0
cvtdq2pd %xmm0,%xmm0
subsd  %xmm0,%xmm1
addsd  0xe67(%rip),%xmm1
andpd  0xe77(%rip),%xmm1
movapd %xmm1,(%rsp)
movapd %xmm1,%xmm0
call   1040 <floor@plt>
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe48(%rip),%xmm1
movapd %xmm1,(%rsp)
cvttsd2si %xmm1,%ebx
movapd %xmm1,%xmm0
call   1040 <floor@plt>
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe25(%rip),%xmm1
cvttsd2si %xmm1,%eax
shl    $0x4,%bl
or     %al,%bl
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @get_byte(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i8
%10 = alloca i8
store i32 %0, i32* %2
%11 = load i32, i32* %2
%12 = call double @series(i32 1, i32 %11)
store double %12, double* %3
%13 = load i32, i32* %2
%14 = call double @series(i32 4, i32 %13)
store double %14, double* %4
%15 = load i32, i32* %2
%16 = call double @series(i32 5, i32 %15)
store double %16, double* %5
%17 = load i32, i32* %2
%18 = call double @series(i32 6, i32 %17)
store double %18, double* %6
%19 = load double, double* %3
%20 = load double, double* %4
%21 = fmul double 2.000000e+00, %20
%22 = fneg double %21
%23 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %19, double %22)
%24 = load double, double* %5
%25 = fsub double %23, %24
%26 = load double, double* %6
%27 = fsub double %25, %26
store double %27, double* %7
%28 = load double, double* %7
%29 = load double, double* %7
%30 = fptosi double %29 to i32
%31 = sitofp i32 %30 to double
%32 = fsub double %28, %31
%33 = fadd double %32, 1.000000e+00
store double %33, double* %7
%34 = load double, double* %7
%35 = call double @llvm.fabs.f64(double %34)
store double %35, double* %8
%36 = load double, double* %8
%37 = load double, double* %8
%38 = call double @llvm.floor.f64(double %37)
%39 = fsub double %36, %38
%40 = fmul double 1.600000e+01, %39
store double %40, double* %8
%41 = load double, double* %8
%42 = fptoui double %41 to i8
store i8 %42, i8* %9
%43 = load double, double* %8
%44 = load double, double* %8
%45 = call double @llvm.floor.f64(double %44)
%46 = fsub double %43, %45
%47 = fmul double 1.600000e+01, %46
store double %47, double* %8
%48 = load double, double* %8
%49 = fptoui double %48 to i8
store i8 %49, i8* %10
%50 = load i8, i8* %9
%51 = zext i8 %50 to i32
%52 = shl i32 %51, 4
%53 = load i8, i8* %10
%54 = zext i8 %53 to i32
%55 = or i32 %52, %54
%56 = trunc i32 %55 to i8
ret i8 %56
}

LLVM IR (-O2):
define zeroext i8 @get_byte(i32 %0) {
%2 = tail call double @series(i32 1, i32 %0)
%3 = tail call double @series(i32 4, i32 %0)
%4 = tail call double @series(i32 5, i32 %0)
%5 = tail call double @series(i32 6, i32 %0)
%6 = fmul double %3, -2.000000e+00
%7 = tail call double @llvm.fmuladd.f64(double %2, double 4.000000e+00, double %6)
%8 = fsub double %7, %4
%9 = fsub double %8, %5
%10 = fptosi double %9 to i32
%11 = sitofp i32 %10 to double
%12 = fsub double %9, %11
%13 = fadd double %12, 1.000000e+00
%14 = tail call double @llvm.fabs.f64(double %13)
%15 = tail call double @llvm.floor.f64(double %14)
%16 = fsub double %14, %15
%17 = fmul double %16, 1.600000e+01
%18 = fptoui double %17 to i8
%19 = tail call double @llvm.floor.f64(double %17)
%20 = fsub double %17, %19
%21 = fmul double %20, 1.600000e+01
%22 = fptoui double %21 to i8
%23 = shl i8 %18, 4
%24 = or i8 %23, %22
ret i8 %24
}