#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 */
scalar_t__ fabsf(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, float, int, float, int);
int /*<<< orphan*/ rotate(float *, double, double, double, double);
int /*<<< orphan*/ stderr;
bool test_rotate() {
  bool result = true;
  float f[16];
  rotate(f, 1.0, -1.0, 2.0, 3.0);
  float e[] = {1.0f,       1.605018f, -3.062035f, 0.0f,
               -3.443808f, 2.379093f, 1.916715f,  0.0f,
               0.303849f,  3.599657f, 4.677582f,  0.0f,
               0.0f,       0.0f,      0.0f,       1.0f};
  for (int i = 0; i < 16; i++) {
    while (fabsf((e)[i] - (f)[i]) > fabsf(0.01 * (e)[i])) {
      fprintf(stderr,
              "compare failed: value:    "
              "%f ("
              "f"
              "[%d])\n"
              "                expected: "
              "%f ("
              "e"
              "[%d])\n",
              (f)[i], i, (e)[i], i);
      result = false;
      break;
    };
  }
  return result;
}


x86 assembly (clang, -O0):
<test_rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x1,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
movsd  0xea2(%rip),%xmm0
movsd  0xea2(%rip),%xmm1
movsd  0xea2(%rip),%xmm2
movsd  0xea2(%rip),%xmm3
call   1060 <rotate@plt>
lea    -0x90(%rbp),%rdi
lea    0xea7(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x94(%rbp)
cmpl   $0x10,-0x94(%rbp)
jge    1272 <test_rotate+0x132>
jmp    11af <test_rotate+0x6f>
movslq -0x94(%rbp),%rax
movss  -0x90(%rbp,%rax,4),%xmm0
ff ff
movslq -0x94(%rbp),%rax
subss  -0x50(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <fabsf@plt>
mov    %rax,-0xa0(%rbp)
movslq -0x94(%rbp),%rax
movss  -0x90(%rbp,%rax,4),%xmm0
ff ff
cvtss2sd %xmm0,%xmm1
movsd  0xe28(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <fabsf@plt>
mov    %rax,%rcx
mov    -0xa0(%rbp),%rax
cmp    %rcx,%rax
jle    1259 <test_rotate+0x119>
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
movslq -0x94(%rbp),%rax
movss  -0x50(%rbp,%rax,4),%xmm0
mov    -0x94(%rbp),%edx
movslq -0x94(%rbp),%rax
movss  -0x90(%rbp,%rax,4),%xmm1
ff ff
mov    -0x94(%rbp),%ecx
lea    0xe23(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    125e <test_rotate+0x11e>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    119d <test_rotate+0x5d>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_rotate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0x10(%rsp),%rdi
movsd  0xeb5(%rip),%xmm0
movsd  0xeb5(%rip),%xmm1
movsd  0xeb5(%rip),%xmm2
movsd  0xeb5(%rip),%xmm3
call   1050 <rotate@plt>
mov    $0x1,%r15d
lea    0xebb(%rip),%rbp
xor    %ebx,%ebx
mov    0x2e62(%rip),%r13
lea    0xeeb(%rip),%r14
jmp    119e <test_rotate+0x6e>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    $0x4,%rbp
cmp    $0x10,%rbx
je     11f8 <test_rotate+0xc8>
movss  0x0(%rbp),%xmm0
movss  %xmm0,0xc(%rsp)
subss  0x10(%rsp,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <fabsf@plt>
mov    %rax,%r12
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe53(%rip),%xmm0
call   1030 <fabsf@plt>
cmp    %rax,%r12
jle    1190 <test_rotate+0x60>
mov    0x0(%r13),%edi
movss  0x10(%rsp,%rbx,4),%xmm0
mov    %r14,%rsi
mov    %ebx,%edx
movss  0xc(%rsp),%xmm1
mov    %ebx,%ecx
call   1040 <fprintf@plt>
xor    %r15d,%r15d
jmp    1190 <test_rotate+0x60>
mov    %r15d,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.test_rotate.e = [16 x float] [float 1.000000e+00, float 0x3FF9AE2760000000, float 0xC0087F0C40000000, float 0.000000e+00, float 0xC00B8CEB40000000, float 0x40030861E0000000, float 0x3FFEAADD60000000, float 0.000000e+00, float 0x3FD3724320000000, float 0x400CCC1900000000, float 0x4012B5D800000000, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00]
@stderr = global i32 0
@.str = [75 x i8] c"compare failed: value: %f (f[%d])\0A expected: %f (e[%d])\0A\00"
define i32 @test_rotate() {
%1 = alloca i32
%2 = alloca [16 x float]
%3 = alloca [16 x float]
%4 = alloca i32
store i32 1, i32* %1
%5 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 0
%6 = call i32 @rotate(float* %5, double 1.000000e+00, double -1.000000e+00, double 2.000000e+00, double 3.000000e+00)
%7 = bitcast [16 x float]* %3 to i8*
store i32 0, i32* %4
br label %8
8: ; preds = %46, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 16
br i1 %10, label %11, label %49
11: ; preds = %8
br label %12
12: ; preds = %11
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [16 x float], [16 x float]* %3, i64 0, i64 %14
%16 = load float, float* %15
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 %18
%20 = load float, float* %19
%21 = fsub float %16, %20
%22 = fpext float %21 to double
%23 = call i64 @fabsf(double %22)
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [16 x float], [16 x float]* %3, i64 0, i64 %25
%27 = load float, float* %26
%28 = fpext float %27 to double
%29 = fmul double 1.000000e-02, %28
%30 = call i64 @fabsf(double %29)
%31 = icmp sgt i64 %23, %30
br i1 %31, label %32, label %45
32: ; preds = %12
%33 = load i32, i32* @stderr
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 %35
%37 = load float, float* %36
%38 = load i32, i32* %4
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [16 x float], [16 x float]* %3, i64 0, i64 %40
%42 = load float, float* %41
%43 = load i32, i32* %4
%44 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), float %37, i32 %38, float %42, i32 %43)
store i32 0, i32* %1
br label %45
45: ; preds = %32, %12
br label %46
46: ; preds = %45
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
store i32 %48, i32* %4
br label %8
49: ; preds = %8
%50 = load i32, i32* %1
ret i32 %50
}

LLVM IR (-O2):
@__const.test_rotate.e = [16 x float] [float 1.000000e+00, float 0x3FF9AE2760000000, float 0xC0087F0C40000000, float 0.000000e+00, float 0xC00B8CEB40000000, float 0x40030861E0000000, float 0x3FFEAADD60000000, float 0.000000e+00, float 0x3FD3724320000000, float 0x400CCC1900000000, float 0x4012B5D800000000, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00]
@stderr = global i32 0
@.str = [75 x i8] c"compare failed: value: %f (f[%d])\0A expected: %f (e[%d])\0A\00"
define i32 @test_rotate() {
%1 = alloca [16 x float]
%2 = bitcast [16 x float]* %1 to i8*
%3 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%4 = call i32 @rotate(float* %3, double 1.000000e+00, double -1.000000e+00, double 2.000000e+00, double 3.000000e+00)
br label %6
5: ; preds = %25
ret i32 %26
6: ; preds = %0, %25
%7 = phi i64 [ 0, %0 ], [ %27, %25 ]
%8 = phi i32 [ 1, %0 ], [ %26, %25 ]
%9 = getelementptr inbounds [16 x float], [16 x float]* @__const.test_rotate.e, i64 0, i64 %7
%10 = load float, float* %9
%11 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 %7
%12 = load float, float* %11
%13 = fsub float %10, %12
%14 = fpext float %13 to double
%15 = call i64 @fabsf(double %14)
%16 = fpext float %10 to double
%17 = fmul double %16, 1.000000e-02
%18 = call i64 @fabsf(double %17)
%19 = icmp sgt i64 %15, %18
br i1 %19, label %20, label %25
20: ; preds = %6
%21 = load i32, i32* @stderr
%22 = load float, float* %11
%23 = trunc i64 %7 to i32
%24 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), float %22, i32 %23, float %10, i32 %23)
br label %25
25: ; preds = %6, %20
%26 = phi i32 [ 0, %20 ], [ %8, %6 ]
%27 = add nuw nsw i64 %7, 1
%28 = icmp eq i64 %27, 16
br i1 %28, label %5, label %6
}