#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*/ printf(char *, ...);
void print_formatted_values(double *acc, double *gyr, double *mag,
                            char *title) {
  printf("              %s\n", title);
  printf("    |     X     |     Y     |     Z\n");
  printf("----+-----------+-----------+-----------\n");
  printf("\033[KAcc | % 9.3f | % 9.3f | % 9.3f\n", acc[0], acc[1], acc[2]);
  printf("\033[KGyr | % 9.3f | % 9.3f | % 9.3f\n", gyr[0], gyr[1], gyr[2]);
  printf("\033[KMag | % 9.3f | % 9.3f | % 9.3f\n", mag[0], mag[1], mag[2]);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_formatted_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
lea    0xeea(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
lea    0xee5(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
lea    0xee0(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_formatted_values>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xebb(%rip),%rdi
mov    %rcx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf25(%rip),%rdi
call   1040 <puts@plt>
lea    0xf3d(%rip),%rdi
call   1040 <puts@plt>
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
movsd  0x10(%rbx),%xmm2
lea    0xe96(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movsd  (%r15),%xmm0
movsd  0x8(%r15),%xmm1
movsd  0x10(%r15),%xmm2
lea    0xe9a(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movsd  (%r14),%xmm0
movsd  0x8(%r14),%xmm1
movsd  0x10(%r14),%xmm2
lea    0xe9e(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [18 x i8] c" %s\0A\00"
@.str.1 = [37 x i8] c" | X | Y | Z\0A\00"
@.str.2 = [42 x i8] c"----+-----------+-----------+-----------\0A\00"
@.str.3 = [35 x i8] c"\1B[KAcc | % 9.3f | % 9.3f | % 9.3f\0A\00"
@.str.4 = [35 x i8] c"\1B[KGyr | % 9.3f | % 9.3f | % 9.3f\0A\00"
@.str.5 = [35 x i8] c"\1B[KMag | % 9.3f | % 9.3f | % 9.3f\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
define void @print_formatted_values(double* %0, double* %1, double* %2, i8* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca i8*
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%13 = load double*, double** %5
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
%16 = load double*, double** %5
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = load double, double* %17
%19 = load double*, double** %5
%20 = getelementptr inbounds double, double* %19, i64 2
%21 = load double, double* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), double %15, double %18, double %21)
%23 = load double*, double** %6
%24 = getelementptr inbounds double, double* %23, i64 0
%25 = load double, double* %24
%26 = load double*, double** %6
%27 = getelementptr inbounds double, double* %26, i64 1
%28 = load double, double* %27
%29 = load double*, double** %6
%30 = getelementptr inbounds double, double* %29, i64 2
%31 = load double, double* %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), double %25, double %28, double %31)
%33 = load double*, double** %7
%34 = getelementptr inbounds double, double* %33, i64 0
%35 = load double, double* %34
%36 = load double*, double** %7
%37 = getelementptr inbounds double, double* %36, i64 1
%38 = load double, double* %37
%39 = load double*, double** %7
%40 = getelementptr inbounds double, double* %39, i64 2
%41 = load double, double* %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), double %35, double %38, double %41)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c" %s\0A\00"
@.str.3 = [35 x i8] c"\1B[KAcc | % 9.3f | % 9.3f | % 9.3f\0A\00"
@.str.4 = [35 x i8] c"\1B[KGyr | % 9.3f | % 9.3f | % 9.3f\0A\00"
@.str.5 = [35 x i8] c"\1B[KMag | % 9.3f | % 9.3f | % 9.3f\0A\00"
@str = [36 x i8] c" | X | Y | Z\00"
@str.7 = [41 x i8] c"----+-----------+-----------+-----------\00"
define void @print_formatted_values(double* nocapture %0, double* nocapture %1, double* nocapture %2, i8* %3) {
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.7, i64 0, i64 0))
%8 = load double, double* %0
%9 = getelementptr inbounds double, double* %0, i64 1
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %0, i64 2
%12 = load double, double* %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), double %8, double %10, double %12)
%14 = load double, double* %1
%15 = getelementptr inbounds double, double* %1, i64 1
%16 = load double, double* %15
%17 = getelementptr inbounds double, double* %1, i64 2
%18 = load double, double* %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), double %14, double %16, double %18)
%20 = load double, double* %2
%21 = getelementptr inbounds double, double* %2, i64 1
%22 = load double, double* %21
%23 = getelementptr inbounds double, double* %2, i64 2
%24 = load double, double* %23
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), double %20, double %22, double %24)
%26 = tail call i32 @putchar(i32 10)
ret void
}