#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 */
typedef int /*<<< orphan*/ BufX;

/* Variables and functions */
int /*<<< orphan*/ poly2reg(float *, float *, float *, int);
int test_rosetta(void) {
  float BufX[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  float BufY[] = {1, 6, 17, 34, 57, 86, 121, 162, 209, 262, 321};
  float Coeff[3];
  int _Coeff[3];
  poly2reg(Coeff, BufX, BufY, (sizeof(BufX) / sizeof(BufX[0])));
  _Coeff[0] = Coeff[0] * 10000;
  _Coeff[1] = Coeff[1] * 10000;
  _Coeff[2] = Coeff[2] * 10000;
  if ((_Coeff[0] == 30000) && (_Coeff[1] == 20000) && (_Coeff[2] == 10000)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_rosetta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x30(%rbp),%rdi
lea    0xeda(%rip),%rsi
mov    $0x2c,%edx
call   1040 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    0xef5(%rip),%rsi
mov    $0x2c,%edx
call   1040 <memcpy@plt>
lea    -0x6c(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x60(%rbp),%rdx
mov    $0xb,%ecx
call   1030 <poly2reg@plt>
movss  0xe8d(%rip),%xmm0
mulss  -0x6c(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x78(%rbp)
movss  0xe79(%rip),%xmm0
mulss  -0x68(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x74(%rbp)
movss  0xe65(%rip),%xmm0
mulss  -0x64(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x70(%rbp)
cmpl   $0x7530,-0x78(%rbp)
jne    11da <test_rosetta+0xba>
cmpl   $0x4e20,-0x74(%rbp)
jne    11da <test_rosetta+0xba>
cmpl   $0x2710,-0x70(%rbp)
jne    11da <test_rosetta+0xba>
movl   $0x1,-0x4(%rbp)
jmp    11e1 <test_rosetta+0xc1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_rosetta>:
sub    $0x78,%rsp
movups 0xf31(%rip),%xmm0
movups %xmm0,0x5c(%rsp)
movaps 0xf19(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xefd(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xf3d(%rip),%xmm0
movups %xmm0,0x2c(%rsp)
movaps 0xf25(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xf09(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rsp,%rdi
lea    0x40(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    $0xb,%ecx
call   1030 <poly2reg@plt>
movsd  (%rsp),%xmm0
mulps  0xe81(%rip),%xmm0
cvttps2dq %xmm0,%xmm0
movss  0x8(%rsp),%xmm1
mulss  0xe8f(%rip),%xmm1
cvttss2si %xmm1,%eax
pcmpeqd 0xe73(%rip),%xmm0
pshufd $0x50,%xmm0,%xmm0
movmskpd %xmm0,%ecx
cmp    $0x3,%cl
sete   %cl
cmp    $0x2710,%eax
sete   %al
and    %cl,%al
movzbl %al,%eax
add    $0x78,%rsp
ret

LLVM IR (-O0):
@__const.test_rosetta.BufX = [11 x float] [float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00, float 9.000000e+00, float 1.000000e+01]
@__const.test_rosetta.BufY = [11 x float] [float 1.000000e+00, float 6.000000e+00, float 1.700000e+01, float 3.400000e+01, float 5.700000e+01, float 8.600000e+01, float 1.210000e+02, float 1.620000e+02, float 2.090000e+02, float 2.620000e+02, float 3.210000e+02]
define i32 @test_rosetta() {
%1 = alloca i32
%2 = alloca [11 x float]
%3 = alloca [11 x float]
%4 = alloca [3 x float]
%5 = alloca [3 x i32]
%6 = bitcast [11 x float]* %2 to i8*
%7 = bitcast [11 x float]* %3 to i8*
%8 = getelementptr inbounds [3 x float], [3 x float]* %4, i64 0, i64 0
%9 = getelementptr inbounds [11 x float], [11 x float]* %2, i64 0, i64 0
%10 = getelementptr inbounds [11 x float], [11 x float]* %3, i64 0, i64 0
%11 = call i32 @poly2reg(float* %8, float* %9, float* %10, i32 11)
%12 = getelementptr inbounds [3 x float], [3 x float]* %4, i64 0, i64 0
%13 = load float, float* %12
%14 = fmul float %13, 1.000000e+04
%15 = fptosi float %14 to i32
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
store i32 %15, i32* %16
%17 = getelementptr inbounds [3 x float], [3 x float]* %4, i64 0, i64 1
%18 = load float, float* %17
%19 = fmul float %18, 1.000000e+04
%20 = fptosi float %19 to i32
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 1
store i32 %20, i32* %21
%22 = getelementptr inbounds [3 x float], [3 x float]* %4, i64 0, i64 2
%23 = load float, float* %22
%24 = fmul float %23, 1.000000e+04
%25 = fptosi float %24 to i32
%26 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 2
store i32 %25, i32* %26
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, 30000
br i1 %29, label %30, label %39
30: ; preds = %0
%31 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 1
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 20000
br i1 %33, label %34, label %39
34: ; preds = %30
%35 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 2
%36 = load i32, i32* %35
%37 = icmp eq i32 %36, 10000
br i1 %37, label %38, label %39
38: ; preds = %34
store i32 1, i32* %1
br label %40
39: ; preds = %34, %30, %0
store i32 0, i32* %1
br label %40
40: ; preds = %39, %38
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
@__const.test_rosetta.BufX = [11 x float] [float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00, float 9.000000e+00, float 1.000000e+01]
@__const.test_rosetta.BufY = [11 x float] [float 1.000000e+00, float 6.000000e+00, float 1.700000e+01, float 3.400000e+01, float 5.700000e+01, float 8.600000e+01, float 1.210000e+02, float 1.620000e+02, float 2.090000e+02, float 2.620000e+02, float 3.210000e+02]
define i32 @test_rosetta() {
%1 = alloca [11 x float]
%2 = alloca [11 x float]
%3 = alloca [3 x float]
%4 = bitcast [11 x float]* %1 to i8*
%5 = bitcast [11 x float]* %2 to i8*
%6 = bitcast [3 x float]* %3 to i8*
%7 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 0
%8 = getelementptr inbounds [11 x float], [11 x float]* %1, i64 0, i64 0
%9 = getelementptr inbounds [11 x float], [11 x float]* %2, i64 0, i64 0
%10 = call i32 @poly2reg(float* %7, float* %8, float* %9, i32 11)
%11 = bitcast [3 x float]* %3 to <2 x float>*
%12 = load <2 x float>, <2 x float>* %11
%13 = fmul <2 x float> %12, <float 1.000000e+04, float 1.000000e+04>
%14 = fptosi <2 x float> %13 to <2 x i32>
%15 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 2
%16 = load float, float* %15
%17 = fmul float %16, 1.000000e+04
%18 = fptosi float %17 to i32
%19 = icmp eq <2 x i32> %14, <i32 30000, i32 20000>
%20 = extractelement <2 x i1> %19, i64 0
%21 = extractelement <2 x i1> %19, i64 1
%22 = select i1 %20, i1 %21, i1 false
%23 = icmp eq i32 %18, 10000
%24 = select i1 %22, i1 %23, i1 false
%25 = zext i1 %24 to i32
ret i32 %25
}