#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 */
float cos(float);
float inkernel_randf();
int /*<<< orphan*/ printf(char *);
float sin(float);
int /*<<< orphan*/ srand(int);
void pet_c_allegro_idtopos(int *id_crystal1, int nidc1, int *id_detector1,
                           int nidd1, float *x1, int nx1, float *y1, int ny1,
                           float *z1, int nz1, int *id_crystal2, int nidc2,
                           int *id_detector2, int nidd2, float *x2, int nx2,
                           float *y2, int ny2, float *z2, int nz2, float respix,
                           int sizespacexy, int sizespacez, int rnd) {
  int nic = 22;
  int njc = 29;
  int nd = 28;
  float dcz = 6.3;
  float dcx = 4.3;
  float rcz = 88.2;
  float rcx = 45.15;
  float tsc = 432;
  float cxyimage = (float)sizespacexy / 2.0f;
  float czimage = (float)sizespacez / 2.0f;
  float xi, yi, zi, a, newx, newy, newz;
  float cosa, sina;
  float dex, dez;
  int n, ID;
  if (rnd) {
    printf("Random pos\n");
  } else {
    printf("No random pos\n");
  }
  if (rnd) {
    srand(rnd);
  }
  for (n = 0; n < nidc1; ++n) {
    ID = id_crystal1[n];
    zi = (float)(ID / nic) * dcz - rcz;
    xi = (float)(ID % nic) * dcx - rcx;
    yi = tsc;
    if (rnd) {
      dex = 4.0f * inkernel_randf() - 2.0f;
      dez = 4.0f * inkernel_randf() - 2.0f;
      xi += dex;
      zi += dez;
    }
    a = (float)id_detector1[n] * (-6.283185307179 / (float)nd) -
        3.141592653589 / 2.0f;
    cosa = cos(a);
    sina = sin(a);
    newx = xi * cosa - yi * sina;
    newy = xi * sina + yi * cosa;
    newx += cxyimage;
    newy = (-newy) + cxyimage;
    newz = zi + czimage;
    newx /= respix;
    newy /= respix;
    newz /= respix;
    x1[n] = newx;
    y1[n] = newy;
    z1[n] = newz;
    ID = id_crystal2[n];
    zi = (float)(ID / nic) * dcz - rcz;
    xi = (float)(ID % nic) * dcx - rcx;
    yi = tsc;
    if (rnd) {
      dex = 4.0f * inkernel_randf() - 2.0f;
      dez = 4.0f * inkernel_randf() - 2.0f;
      xi += dex;
      zi += dez;
    }
    a = (float)id_detector2[n] * (-6.283185307179 / (float)nd) -
        3.141592653589 / 2.0f;
    cosa = cos(a);
    sina = sin(a);
    newx = xi * cosa - yi * sina;
    newy = xi * sina + yi * cosa;
    newx += cxyimage;
    newy = (-newy) + cxyimage;
    newz = zi + czimage;
    newx /= respix;
    newy /= respix;
    newz /= respix;
    x2[n] = newx;
    y2[n] = newy;
    z2[n] = newz;
  }
}


x86 assembly (clang, -O0):
<pet_c_allegro_idtopos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    0x90(%rbp),%eax
mov    0x88(%rbp),%eax
mov    0x80(%rbp),%eax
mov    0x78(%rbp),%eax
mov    0x70(%rbp),%rax
mov    0x68(%rbp),%eax
mov    0x60(%rbp),%rax
mov    0x58(%rbp),%eax
mov    0x50(%rbp),%rax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movss  %xmm0,-0x30(%rbp)
movl   $0x16,-0x34(%rbp)
movl   $0x1d,-0x38(%rbp)
movl   $0x1c,-0x3c(%rbp)
movss  0xe3e(%rip),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  0xe2d(%rip),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  0xe1c(%rip),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  0xe0b(%rip),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  0xdfa(%rip),%xmm0
movss  %xmm0,-0x50(%rbp)
cvtsi2ssl 0x80(%rbp),%xmm0
movss  0xde1(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x54(%rbp)
cvtsi2ssl 0x88(%rbp),%xmm0
movss  0xdc8(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x58(%rbp)
cmpl   $0x0,0x90(%rbp)
je     125f <pet_c_allegro_idtopos+0x10f>
lea    0xddb(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <pet_c_allegro_idtopos+0x11b>
lea    0xdd6(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,0x90(%rbp)
je     1283 <pet_c_allegro_idtopos+0x133>
mov    0x90(%rbp),%edi
call   1040 <srand@plt>
movl   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1768 <pet_c_allegro_idtopos+0x618>
mov    -0x8(%rbp),%rax
movslq -0x88(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cltd
idivl  -0x34(%rbp)
cvtsi2ss %eax,%xmm0
movss  -0x40(%rbp),%xmm2
movss  -0x48(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x64(%rbp)
mov    -0x8c(%rbp),%eax
cltd
idivl  -0x34(%rbp)
cvtsi2ss %edx,%xmm0
movss  -0x44(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x60(%rbp)
cmpl   $0x0,0x90(%rbp)
je     1397 <pet_c_allegro_idtopos+0x247>
mov    $0x0,%al
call   1060 <inkernel_randf@plt>
movss  0xcde(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xcd6(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x80(%rbp)
mov    $0x0,%al
call   1060 <inkernel_randf@plt>
movss  0xcba(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xcb2(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x84(%rbp)
ff
movss  -0x80(%rbp),%xmm0
addss  -0x5c(%rbp),%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x84(%rbp),%xmm0
ff
addss  -0x64(%rbp),%xmm0
movss  %xmm0,-0x64(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x88(%rbp),%rcx
cvtsi2ssl (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
cvtsi2ssl -0x3c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xc6c(%rip),%xmm1
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc54(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x68(%rbp)
movss  -0x68(%rbp),%xmm0
call   1070 <cos@plt>
movss  %xmm0,-0x78(%rbp)
movss  -0x68(%rbp),%xmm0
call   1050 <sin@plt>
movss  %xmm0,-0x7c(%rbp)
movss  -0x5c(%rbp),%xmm0
movss  -0x78(%rbp),%xmm2
movss  -0x60(%rbp),%xmm1
mulss  -0x7c(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x6c(%rbp)
movss  -0x5c(%rbp),%xmm0
movss  -0x7c(%rbp),%xmm2
movss  -0x60(%rbp),%xmm1
mulss  -0x78(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x54(%rbp),%xmm0
addss  -0x6c(%rbp),%xmm0
movss  %xmm0,-0x6c(%rbp)
movss  -0x70(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
addss  -0x54(%rbp),%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x64(%rbp),%xmm0
addss  -0x58(%rbp),%xmm0
movss  %xmm0,-0x74(%rbp)
movss  -0x30(%rbp),%xmm1
movss  -0x6c(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x6c(%rbp)
movss  -0x30(%rbp),%xmm1
movss  -0x70(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x30(%rbp),%xmm1
movss  -0x74(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x74(%rbp)
movss  -0x6c(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x88(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x70(%rbp),%xmm0
mov    0x10(%rbp),%rax
movslq -0x88(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x74(%rbp),%xmm0
mov    0x20(%rbp),%rax
movslq -0x88(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    0x30(%rbp),%rax
movslq -0x88(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cltd
idivl  -0x34(%rbp)
cvtsi2ss %eax,%xmm0
movss  -0x40(%rbp),%xmm2
movss  -0x48(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x64(%rbp)
mov    -0x8c(%rbp),%eax
cltd
idivl  -0x34(%rbp)
cvtsi2ss %edx,%xmm0
movss  -0x44(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x60(%rbp)
cmpl   $0x0,0x90(%rbp)
je     15f3 <pet_c_allegro_idtopos+0x4a3>
mov    $0x0,%al
call   1060 <inkernel_randf@plt>
movss  0xa82(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xa7a(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x80(%rbp)
mov    $0x0,%al
call   1060 <inkernel_randf@plt>
movss  0xa5e(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xa56(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x84(%rbp)
ff
movss  -0x80(%rbp),%xmm0
addss  -0x5c(%rbp),%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x84(%rbp),%xmm0
ff
addss  -0x64(%rbp),%xmm0
movss  %xmm0,-0x64(%rbp)
mov    0x40(%rbp),%rax
movslq -0x88(%rbp),%rcx
cvtsi2ssl (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
cvtsi2ssl -0x3c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xa10(%rip),%xmm1
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0x9f8(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x68(%rbp)
movss  -0x68(%rbp),%xmm0
call   1070 <cos@plt>
movss  %xmm0,-0x78(%rbp)
movss  -0x68(%rbp),%xmm0
call   1050 <sin@plt>
movss  %xmm0,-0x7c(%rbp)
movss  -0x5c(%rbp),%xmm0
movss  -0x78(%rbp),%xmm2
movss  -0x60(%rbp),%xmm1
mulss  -0x7c(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x6c(%rbp)
movss  -0x5c(%rbp),%xmm0
movss  -0x7c(%rbp),%xmm2
movss  -0x60(%rbp),%xmm1
mulss  -0x78(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x54(%rbp),%xmm0
addss  -0x6c(%rbp),%xmm0
movss  %xmm0,-0x6c(%rbp)
movss  -0x70(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
addss  -0x54(%rbp),%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x64(%rbp),%xmm0
addss  -0x58(%rbp),%xmm0
movss  %xmm0,-0x74(%rbp)
movss  -0x30(%rbp),%xmm1
movss  -0x6c(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x6c(%rbp)
movss  -0x30(%rbp),%xmm1
movss  -0x70(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x30(%rbp),%xmm1
movss  -0x74(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x74(%rbp)
movss  -0x6c(%rbp),%xmm0
mov    0x50(%rbp),%rax
movslq -0x88(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x70(%rbp),%xmm0
mov    0x60(%rbp),%rax
movslq -0x88(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x74(%rbp),%xmm0
mov    0x70(%rbp),%rax
movslq -0x88(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    128d <pet_c_allegro_idtopos+0x13d>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pet_c_allegro_idtopos>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movss  %xmm0,0xc(%rsp)
mov    %r8,%r14
mov    %rdx,%r15
mov    %esi,%r12d
mov    %rdi,%rbx
mov    0xf0(%rsp),%ebp
test   %ebp,%ebp
je     1198 <pet_c_allegro_idtopos+0x48>
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
call   1040 <srand@plt>
test   %r12d,%r12d
jg     11ad <pet_c_allegro_idtopos+0x5d>
jmp    1487 <pet_c_allegro_idtopos+0x337>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
test   %r12d,%r12d
jle    1487 <pet_c_allegro_idtopos+0x337>
cvtsi2ssl 0xe0(%rsp),%xmm1
movss  0xe42(%rip),%xmm0
cvtsi2ssl 0xe8(%rsp),%xmm2
mulss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
mulss  %xmm0,%xmm2
movss  %xmm2,0x4(%rsp)
mov    %r12d,%r12d
shl    $0x2,%r12
xor    %r13d,%r13d
jmp    12c5 <pet_c_allegro_idtopos+0x175>
nopw   0x0(%rax,%rax,1)
mov    0xa0(%rsp),%rax
xorps  %xmm0,%xmm0
cvtsi2ssl (%rax,%r13,1),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe43(%rip),%xmm0
addsd  0xe43(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsp)
call   1070 <cos@plt>
movss  %xmm0,0x10(%rsp)
movss  (%rsp),%xmm0
call   1050 <sin@plt>
movaps 0x20(%rsp),%xmm3
movaps %xmm3,%xmm1
mulss  %xmm0,%xmm1
mulss  0xdbd(%rip),%xmm0
movaps %xmm3,%xmm2
movss  0x10(%rsp),%xmm4
mulss  %xmm4,%xmm2
addss  %xmm0,%xmm2
mulss  0xda8(%rip),%xmm4
addss  %xmm1,%xmm4
movss  0x8(%rsp),%xmm0
addss  %xmm0,%xmm2
subss  %xmm4,%xmm0
shufps $0x55,%xmm3,%xmm3
addss  0x4(%rsp),%xmm3
movss  0xc(%rsp),%xmm1
divss  %xmm1,%xmm2
divss  %xmm1,%xmm0
divss  %xmm1,%xmm3
mov    0xb0(%rsp),%rax
movss  %xmm2,(%rax,%r13,1)
mov    0xc0(%rsp),%rax
movss  %xmm0,(%rax,%r13,1)
mov    0xd0(%rsp),%rax
movss  %xmm3,(%rax,%r13,1)
add    $0x4,%r13
cmp    %r13,%r12
je     1487 <pet_c_allegro_idtopos+0x337>
movslq (%rbx,%r13,1),%rax
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
movd   %eax,%xmm0
movd   %ecx,%xmm1
punpckldq %xmm1,%xmm0
cvtdq2ps %xmm0,%xmm0
mulps  0xd13(%rip),%xmm0
addps  0xd1c(%rip),%xmm0
test   %ebp,%ebp
movaps %xmm0,0x20(%rsp)
je     1343 <pet_c_allegro_idtopos+0x1f3>
xor    %eax,%eax
call   1060 <inkernel_randf@plt>
movaps %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1060 <inkernel_randf@plt>
movaps 0x10(%rsp),%xmm1
unpcklps %xmm0,%xmm1
mulps  0xd01(%rip),%xmm1
addps  0xd0a(%rip),%xmm1
movaps 0x20(%rsp),%xmm0
addps  %xmm1,%xmm0
movaps %xmm0,0x20(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ssl (%r15,%r13,1),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xcf8(%rip),%xmm0
addsd  0xcf8(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsp)
call   1070 <cos@plt>
movss  %xmm0,0x10(%rsp)
movss  (%rsp),%xmm0
call   1050 <sin@plt>
movaps 0x20(%rsp),%xmm3
movaps %xmm3,%xmm1
mulss  %xmm0,%xmm1
mulss  0xc72(%rip),%xmm0
movaps %xmm3,%xmm2
movss  0x10(%rsp),%xmm4
mulss  %xmm4,%xmm2
addss  %xmm0,%xmm2
mulss  0xc5d(%rip),%xmm4
addss  %xmm1,%xmm4
movss  0x8(%rsp),%xmm0
addss  %xmm0,%xmm2
subss  %xmm4,%xmm0
shufps $0x55,%xmm3,%xmm3
addss  0x4(%rsp),%xmm3
movss  0xc(%rsp),%xmm1
divss  %xmm1,%xmm2
divss  %xmm1,%xmm0
divss  %xmm1,%xmm3
movss  %xmm2,(%r14,%r13,1)
mov    0x70(%rsp),%rax
movss  %xmm0,(%rax,%r13,1)
mov    0x80(%rsp),%rax
movss  %xmm3,(%rax,%r13,1)
mov    0x90(%rsp),%rax
movslq (%rax,%r13,1),%rax
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
movd   %eax,%xmm0
movd   %ecx,%xmm1
punpckldq %xmm1,%xmm0
cvtdq2ps %xmm0,%xmm0
mulps  0xbd8(%rip),%xmm0
addps  0xbe1(%rip),%xmm0
test   %ebp,%ebp
movaps %xmm0,0x20(%rsp)
je     11f0 <pet_c_allegro_idtopos+0xa0>
xor    %eax,%eax
call   1060 <inkernel_randf@plt>
movaps %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1060 <inkernel_randf@plt>
movaps 0x10(%rsp),%xmm1
unpcklps %xmm0,%xmm1
mulps  0xbc2(%rip),%xmm1
addps  0xbcb(%rip),%xmm1
movaps 0x20(%rsp),%xmm0
addps  %xmm1,%xmm0
movaps %xmm0,0x20(%rsp)
jmp    11f0 <pet_c_allegro_idtopos+0xa0>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Random pos\0A\00"
@.str.1 = [15 x i8] c"No random pos\0A\00"
define void @pet_c_allegro_idtopos(i32* %0, i32 %1, i32* %2, i32 %3, float* %4, i32 %5, float* %6, i32 %7, float* %8, i32 %9, i32* %10, i32 %11, i32* %12, i32 %13, float* %14, i32 %15, float* %16, i32 %17, float* %18, i32 %19, float %20, i32 %21, i32 %22, i32 %23) {
%25 = alloca i32*
%26 = alloca i32
%27 = alloca i32*
%28 = alloca i32
%29 = alloca float*
%30 = alloca i32
%31 = alloca float*
%32 = alloca i32
%33 = alloca float*
%34 = alloca i32
%35 = alloca i32*
%36 = alloca i32
%37 = alloca i32*
%38 = alloca i32
%39 = alloca float*
%40 = alloca i32
%41 = alloca float*
%42 = alloca i32
%43 = alloca float*
%44 = alloca i32
%45 = alloca float
%46 = alloca i32
%47 = alloca i32
%48 = alloca i32
%49 = alloca i32
%50 = alloca i32
%51 = alloca i32
%52 = alloca float
%53 = alloca float
%54 = alloca float
%55 = alloca float
%56 = alloca float
%57 = alloca float
%58 = alloca float
%59 = alloca float
%60 = alloca float
%61 = alloca float
%62 = alloca float
%63 = alloca float
%64 = alloca float
%65 = alloca float
%66 = alloca float
%67 = alloca float
%68 = alloca float
%69 = alloca float
%70 = alloca i32
%71 = alloca i32
store i32* %0, i32** %25
store i32 %1, i32* %26
store i32* %2, i32** %27
store i32 %3, i32* %28
store float* %4, float** %29
store i32 %5, i32* %30
store float* %6, float** %31
store i32 %7, i32* %32
store float* %8, float** %33
store i32 %9, i32* %34
store i32* %10, i32** %35
store i32 %11, i32* %36
store i32* %12, i32** %37
store i32 %13, i32* %38
store float* %14, float** %39
store i32 %15, i32* %40
store float* %16, float** %41
store i32 %17, i32* %42
store float* %18, float** %43
store i32 %19, i32* %44
store float %20, float* %45
store i32 %21, i32* %46
store i32 %22, i32* %47
store i32 %23, i32* %48
store i32 22, i32* %49
store i32 29, i32* %50
store i32 28, i32* %51
store float 0x4019333340000000, float* %52
store float 0x4011333340000000, float* %53
store float 0x40560CCCC0000000, float* %54
store float 0x4046933340000000, float* %55
store float 4.320000e+02, float* %56
%72 = load i32, i32* %46
%73 = sitofp i32 %72 to float
%74 = fdiv float %73, 2.000000e+00
store float %74, float* %57
%75 = load i32, i32* %47
%76 = sitofp i32 %75 to float
%77 = fdiv float %76, 2.000000e+00
store float %77, float* %58
%78 = load i32, i32* %48
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %24
%81 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %84
82: ; preds = %24
%83 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %84
84: ; preds = %82, %80
%85 = load i32, i32* %48
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %90
87: ; preds = %84
%88 = load i32, i32* %48
%89 = call i32 @srand(i32 %88)
br label %90
90: ; preds = %87, %84
store i32 0, i32* %70
br label %91
91: ; preds = %296, %90
%92 = load i32, i32* %70
%93 = load i32, i32* %26
%94 = icmp slt i32 %92, %93
br i1 %94, label %95, label %299
95: ; preds = %91
%96 = load i32*, i32** %25
%97 = load i32, i32* %70
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i32, i32* %96, i64 %98
%100 = load i32, i32* %99
store i32 %100, i32* %71
%101 = load i32, i32* %71
%102 = load i32, i32* %49
%103 = sdiv i32 %101, %102
%104 = sitofp i32 %103 to float
%105 = load float, float* %52
%106 = load float, float* %54
%107 = fneg float %106
%108 = call float @llvm.fmuladd.f32(float %104, float %105, float %107)
store float %108, float* %61
%109 = load i32, i32* %71
%110 = load i32, i32* %49
%111 = srem i32 %109, %110
%112 = sitofp i32 %111 to float
%113 = load float, float* %53
%114 = load float, float* %55
%115 = fneg float %114
%116 = call float @llvm.fmuladd.f32(float %112, float %113, float %115)
store float %116, float* %59
%117 = load float, float* %56
store float %117, float* %60
%118 = load i32, i32* %48
%119 = icmp ne i32 %118, 0
br i1 %119, label %120, label %131
120: ; preds = %95
%121 = call float (...) @inkernel_randf()
%122 = call float @llvm.fmuladd.f32(float 4.000000e+00, float %121, float -2.000000e+00)
store float %122, float* %68
%123 = call float (...) @inkernel_randf()
%124 = call float @llvm.fmuladd.f32(float 4.000000e+00, float %123, float -2.000000e+00)
store float %124, float* %69
%125 = load float, float* %68
%126 = load float, float* %59
%127 = fadd float %126, %125
store float %127, float* %59
%128 = load float, float* %69
%129 = load float, float* %61
%130 = fadd float %129, %128
store float %130, float* %61
br label %131
131: ; preds = %120, %95
%132 = load i32*, i32** %27
%133 = load i32, i32* %70
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds i32, i32* %132, i64 %134
%136 = load i32, i32* %135
%137 = sitofp i32 %136 to float
%138 = fpext float %137 to double
%139 = load i32, i32* %51
%140 = sitofp i32 %139 to float
%141 = fpext float %140 to double
%142 = fdiv double 0xC01921FB54442A84, %141
%143 = call double @llvm.fmuladd.f64(double %138, double %142, double 0xBFF921FB5444261E)
%144 = fptrunc double %143 to float
store float %144, float* %62
%145 = load float, float* %62
%146 = call float @cos(float %145)
store float %146, float* %66
%147 = load float, float* %62
%148 = call float @sin(float %147)
store float %148, float* %67
%149 = load float, float* %59
%150 = load float, float* %66
%151 = load float, float* %60
%152 = load float, float* %67
%153 = fmul float %151, %152
%154 = fneg float %153
%155 = call float @llvm.fmuladd.f32(float %149, float %150, float %154)
store float %155, float* %63
%156 = load float, float* %59
%157 = load float, float* %67
%158 = load float, float* %60
%159 = load float, float* %66
%160 = fmul float %158, %159
%161 = call float @llvm.fmuladd.f32(float %156, float %157, float %160)
store float %161, float* %64
%162 = load float, float* %57
%163 = load float, float* %63
%164 = fadd float %163, %162
store float %164, float* %63
%165 = load float, float* %64
%166 = fneg float %165
%167 = load float, float* %57
%168 = fadd float %166, %167
store float %168, float* %64
%169 = load float, float* %61
%170 = load float, float* %58
%171 = fadd float %169, %170
store float %171, float* %65
%172 = load float, float* %45
%173 = load float, float* %63
%174 = fdiv float %173, %172
store float %174, float* %63
%175 = load float, float* %45
%176 = load float, float* %64
%177 = fdiv float %176, %175
store float %177, float* %64
%178 = load float, float* %45
%179 = load float, float* %65
%180 = fdiv float %179, %178
store float %180, float* %65
%181 = load float, float* %63
%182 = load float*, float** %29
%183 = load i32, i32* %70
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds float, float* %182, i64 %184
store float %181, float* %185
%186 = load float, float* %64
%187 = load float*, float** %31
%188 = load i32, i32* %70
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds float, float* %187, i64 %189
store float %186, float* %190
%191 = load float, float* %65
%192 = load float*, float** %33
%193 = load i32, i32* %70
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds float, float* %192, i64 %194
store float %191, float* %195
%196 = load i32*, i32** %35
%197 = load i32, i32* %70
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds i32, i32* %196, i64 %198
%200 = load i32, i32* %199
store i32 %200, i32* %71
%201 = load i32, i32* %71
%202 = load i32, i32* %49
%203 = sdiv i32 %201, %202
%204 = sitofp i32 %203 to float
%205 = load float, float* %52
%206 = load float, float* %54
%207 = fneg float %206
%208 = call float @llvm.fmuladd.f32(float %204, float %205, float %207)
store float %208, float* %61
%209 = load i32, i32* %71
%210 = load i32, i32* %49
%211 = srem i32 %209, %210
%212 = sitofp i32 %211 to float
%213 = load float, float* %53
%214 = load float, float* %55
%215 = fneg float %214
%216 = call float @llvm.fmuladd.f32(float %212, float %213, float %215)
store float %216, float* %59
%217 = load float, float* %56
store float %217, float* %60
%218 = load i32, i32* %48
%219 = icmp ne i32 %218, 0
br i1 %219, label %220, label %231
220: ; preds = %131
%221 = call float (...) @inkernel_randf()
%222 = call float @llvm.fmuladd.f32(float 4.000000e+00, float %221, float -2.000000e+00)
store float %222, float* %68
%223 = call float (...) @inkernel_randf()
%224 = call float @llvm.fmuladd.f32(float 4.000000e+00, float %223, float -2.000000e+00)
store float %224, float* %69
%225 = load float, float* %68
%226 = load float, float* %59
%227 = fadd float %226, %225
store float %227, float* %59
%228 = load float, float* %69
%229 = load float, float* %61
%230 = fadd float %229, %228
store float %230, float* %61
br label %231
231: ; preds = %220, %131
%232 = load i32*, i32** %37
%233 = load i32, i32* %70
%234 = sext i32 %233 to i64
%235 = getelementptr inbounds i32, i32* %232, i64 %234
%236 = load i32, i32* %235
%237 = sitofp i32 %236 to float
%238 = fpext float %237 to double
%239 = load i32, i32* %51
%240 = sitofp i32 %239 to float
%241 = fpext float %240 to double
%242 = fdiv double 0xC01921FB54442A84, %241
%243 = call double @llvm.fmuladd.f64(double %238, double %242, double 0xBFF921FB5444261E)
%244 = fptrunc double %243 to float
store float %244, float* %62
%245 = load float, float* %62
%246 = call float @cos(float %245)
store float %246, float* %66
%247 = load float, float* %62
%248 = call float @sin(float %247)
store float %248, float* %67
%249 = load float, float* %59
%250 = load float, float* %66
%251 = load float, float* %60
%252 = load float, float* %67
%253 = fmul float %251, %252
%254 = fneg float %253
%255 = call float @llvm.fmuladd.f32(float %249, float %250, float %254)
store float %255, float* %63
%256 = load float, float* %59
%257 = load float, float* %67
%258 = load float, float* %60
%259 = load float, float* %66
%260 = fmul float %258, %259
%261 = call float @llvm.fmuladd.f32(float %256, float %257, float %260)
store float %261, float* %64
%262 = load float, float* %57
%263 = load float, float* %63
%264 = fadd float %263, %262
store float %264, float* %63
%265 = load float, float* %64
%266 = fneg float %265
%267 = load float, float* %57
%268 = fadd float %266, %267
store float %268, float* %64
%269 = load float, float* %61
%270 = load float, float* %58
%271 = fadd float %269, %270
store float %271, float* %65
%272 = load float, float* %45
%273 = load float, float* %63
%274 = fdiv float %273, %272
store float %274, float* %63
%275 = load float, float* %45
%276 = load float, float* %64
%277 = fdiv float %276, %275
store float %277, float* %64
%278 = load float, float* %45
%279 = load float, float* %65
%280 = fdiv float %279, %278
store float %280, float* %65
%281 = load float, float* %63
%282 = load float*, float** %39
%283 = load i32, i32* %70
%284 = sext i32 %283 to i64
%285 = getelementptr inbounds float, float* %282, i64 %284
store float %281, float* %285
%286 = load float, float* %64
%287 = load float*, float** %41
%288 = load i32, i32* %70
%289 = sext i32 %288 to i64
%290 = getelementptr inbounds float, float* %287, i64 %289
store float %286, float* %290
%291 = load float, float* %65
%292 = load float*, float** %43
%293 = load i32, i32* %70
%294 = sext i32 %293 to i64
%295 = getelementptr inbounds float, float* %292, i64 %294
store float %291, float* %295
br label %296
296: ; preds = %231
%297 = load i32, i32* %70
%298 = add nsw i32 %297, 1
store i32 %298, i32* %70
br label %91
299: ; preds = %91
ret void
}

LLVM IR (-O2):
@str = [14 x i8] c"No random pos\00"
@str.2 = [11 x i8] c"Random pos\00"
define void @pet_c_allegro_idtopos(i32* nocapture %0, i32 %1, i32* nocapture %2, i32 %3, float* nocapture writeonly %4, i32 %5, float* nocapture writeonly %6, i32 %7, float* nocapture writeonly %8, i32 %9, i32* nocapture %10, i32 %11, i32* nocapture %12, i32 %13, float* nocapture writeonly %14, i32 %15, float* nocapture writeonly %16, i32 %17, float* nocapture writeonly %18, i32 %19, float %20, i32 %21, i32 %22, i32 %23) {
%25 = sitofp i32 %21 to float
%26 = fmul float %25, 5.000000e-01
%27 = sitofp i32 %22 to float
%28 = fmul float %27, 5.000000e-01
%29 = icmp eq i32 %23, 0
br i1 %29, label %30, label %32
30: ; preds = %24
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %35
32: ; preds = %24
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.2, i64 0, i64 0))
%34 = tail call i32 @srand(i32 %23)
br label %35
35: ; preds = %30, %32
%36 = icmp sgt i32 %1, 0
br i1 %36, label %37, label %123
37: ; preds = %35
%38 = zext i32 %1 to i64
br label %39
39: ; preds = %37, %96
%40 = phi i64 [ 0, %37 ], [ %121, %96 ]
%41 = getelementptr inbounds i32, i32* %0, i64 %40
%42 = load i32, i32* %41
%43 = sdiv i32 %42, 22
%44 = srem i32 %42, 22
%45 = insertelement <2 x i32> poison, i32 %44, i64 0
%46 = insertelement <2 x i32> %45, i32 %43, i64 1
%47 = sitofp <2 x i32> %46 to <2 x float>
%48 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %47, <2 x float> <float 0x4011333340000000, float 0x4019333340000000>, <2 x float> <float 0xC046933340000000, float 0xC0560CCCC0000000>)
br i1 %29, label %56, label %49
49: ; preds = %39
%50 = tail call float (...) @inkernel_randf()
%51 = tail call float (...) @inkernel_randf()
%52 = insertelement <2 x float> poison, float %50, i64 0
%53 = insertelement <2 x float> %52, float %51, i64 1
%54 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %53, <2 x float> <float 4.000000e+00, float 4.000000e+00>, <2 x float> <float -2.000000e+00, float -2.000000e+00>)
%55 = fadd <2 x float> %48, %54
br label %56
56: ; preds = %49, %39
%57 = phi <2 x float> [ %55, %49 ], [ %48, %39 ]
%58 = getelementptr inbounds i32, i32* %2, i64 %40
%59 = load i32, i32* %58
%60 = sitofp i32 %59 to float
%61 = fpext float %60 to double
%62 = tail call double @llvm.fmuladd.f64(double %61, double 0xBFCCB91F3BBB9E4E, double 0xBFF921FB5444261E)
%63 = fptrunc double %62 to float
%64 = tail call float @cos(float %63)
%65 = tail call float @sin(float %63)
%66 = fmul float %65, -4.320000e+02
%67 = extractelement <2 x float> %57, i64 0
%68 = tail call float @llvm.fmuladd.f32(float %67, float %64, float %66)
%69 = fmul float %64, 4.320000e+02
%70 = tail call float @llvm.fmuladd.f32(float %67, float %65, float %69)
%71 = fadd float %26, %68
%72 = fsub float %26, %70
%73 = extractelement <2 x float> %57, i64 1
%74 = fadd float %28, %73
%75 = fdiv float %71, %20
%76 = fdiv float %72, %20
%77 = fdiv float %74, %20
%78 = getelementptr inbounds float, float* %4, i64 %40
store float %75, float* %78
%79 = getelementptr inbounds float, float* %6, i64 %40
store float %76, float* %79
%80 = getelementptr inbounds float, float* %8, i64 %40
store float %77, float* %80
%81 = getelementptr inbounds i32, i32* %10, i64 %40
%82 = load i32, i32* %81
%83 = sdiv i32 %82, 22
%84 = srem i32 %82, 22
%85 = insertelement <2 x i32> poison, i32 %84, i64 0
%86 = insertelement <2 x i32> %85, i32 %83, i64 1
%87 = sitofp <2 x i32> %86 to <2 x float>
%88 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %87, <2 x float> <float 0x4011333340000000, float 0x4019333340000000>, <2 x float> <float 0xC046933340000000, float 0xC0560CCCC0000000>)
br i1 %29, label %96, label %89
89: ; preds = %56
%90 = tail call float (...) @inkernel_randf()
%91 = tail call float (...) @inkernel_randf()
%92 = insertelement <2 x float> poison, float %90, i64 0
%93 = insertelement <2 x float> %92, float %91, i64 1
%94 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %93, <2 x float> <float 4.000000e+00, float 4.000000e+00>, <2 x float> <float -2.000000e+00, float -2.000000e+00>)
%95 = fadd <2 x float> %88, %94
br label %96
96: ; preds = %89, %56
%97 = phi <2 x float> [ %95, %89 ], [ %88, %56 ]
%98 = getelementptr inbounds i32, i32* %12, i64 %40
%99 = load i32, i32* %98
%100 = sitofp i32 %99 to float
%101 = fpext float %100 to double
%102 = tail call double @llvm.fmuladd.f64(double %101, double 0xBFCCB91F3BBB9E4E, double 0xBFF921FB5444261E)
%103 = fptrunc double %102 to float
%104 = tail call float @cos(float %103)
%105 = tail call float @sin(float %103)
%106 = fmul float %105, -4.320000e+02
%107 = extractelement <2 x float> %97, i64 0
%108 = tail call float @llvm.fmuladd.f32(float %107, float %104, float %106)
%109 = fmul float %104, 4.320000e+02
%110 = tail call float @llvm.fmuladd.f32(float %107, float %105, float %109)
%111 = fadd float %26, %108
%112 = fsub float %26, %110
%113 = extractelement <2 x float> %97, i64 1
%114 = fadd float %28, %113
%115 = fdiv float %111, %20
%116 = fdiv float %112, %20
%117 = fdiv float %114, %20
%118 = getelementptr inbounds float, float* %14, i64 %40
store float %115, float* %118
%119 = getelementptr inbounds float, float* %16, i64 %40
store float %116, float* %119
%120 = getelementptr inbounds float, float* %18, i64 %40
store float %117, float* %120
%121 = add nuw nsw i64 %40, 1
%122 = icmp eq i64 %121, %38
br i1 %122, label %123, label %39
123: ; preds = %96, %35
ret void
}