#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 */
struct icom {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ imaddhistf(struct icom *, char *, double, double);
int imget_fits_float_value(struct icom *, char *, float *);
int /*<<< orphan*/ imupdate_fitsf(struct icom *, char *, char *, float, char *);
int imc_rotate_WCS(struct icom *icom, float dx, float dy, double cos_rot,
                   double sin_rot) {
  float crpix1, crpix2;
  float cd11, cd12, cd21, cd22;
  float pc11, pc12, pc21, pc22;
  if (imget_fits_float_value(icom, "CRPIX1", &crpix1) == 1 &&
      imget_fits_float_value(icom, "CRPIX2", &crpix2) == 1) {
    imupdate_fitsf(icom, "CRPIX1", "%20.1f / %-47.47s",
                   crpix1 * cos_rot - crpix2 * sin_rot + dx, "");
    imupdate_fitsf(icom, "CRPIX2", "%20.1f / %-47.47s",
                   crpix1 * sin_rot + crpix2 * cos_rot + dy, "");
    if ((imget_fits_float_value(icom, "CD1_1", &cd11) +
         imget_fits_float_value(icom, "CD1_2", &cd12) +
         imget_fits_float_value(icom, "CD2_1", &cd21) +
         imget_fits_float_value(icom, "CD2_2", &cd22)) != 0) {
      imupdate_fitsf(icom, "CD1_1", "%20.8f / %-47.47s",
                     (cd11 * cos_rot - cd21 * sin_rot), "");
      imupdate_fitsf(icom, "CD1_2", "%20.8f / %-47.47s",
                     (cd12 * cos_rot - cd22 * sin_rot), "");
      imupdate_fitsf(icom, "CD2_1", "%20.8f / %-47.47s",
                     (cd11 * sin_rot + cd21 * cos_rot), "");
      imupdate_fitsf(icom, "CD2_2", "%20.8f / %-47.47s",
                     (cd12 * sin_rot + cd22 * cos_rot), "");
    }
    if (imget_fits_float_value(icom, "PC001001", &pc11) == 1 &&
        imget_fits_float_value(icom, "PC001002", &pc12) == 1 &&
        imget_fits_float_value(icom, "PC002001", &pc21) == 1 &&
        imget_fits_float_value(icom, "PC002002", &pc22) == 1) {
      imupdate_fitsf(icom, "PC001001", "%20.8f / %-47.47s",
                     (pc11 * cos_rot + pc21 * sin_rot), "");
      imupdate_fitsf(icom, "PC001002", "%20.8f / %-47.47s",
                     (pc12 * cos_rot + pc22 * sin_rot), "");
      imupdate_fitsf(icom, "PC002001", "%20.8f / %-47.47s",
                     (-pc11 * sin_rot + pc21 * cos_rot), "");
      imupdate_fitsf(icom, "PC002002", "%20.8f / %-47.47s",
                     (-pc12 * sin_rot + pc22 * cos_rot), "");
    }
    imaddhistf(icom, "WCS is rotated sin=%f cos=%f", sin_rot, cos_rot);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<imc_rotate_WCS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea5(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    15d0 <imc_rotate_WCS+0x4a0>
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    15d0 <imc_rotate_WCS+0x4a0>
mov    -0x10(%rbp),%rdi
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x20(%rbp),%xmm2
movss  -0x30(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xe1f(%rip),%rsi
lea    0xe26(%rip),%rdx
lea    0xe63(%rip),%rcx
call   1050 <imupdate_fitsf@plt>
mov    -0x10(%rbp),%rdi
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x28(%rbp),%xmm2
movss  -0x30(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xdd3(%rip),%rsi
lea    0xdd3(%rip),%rdx
lea    0xe10(%rip),%rcx
call   1050 <imupdate_fitsf@plt>
mov    -0x10(%rbp),%rdi
lea    0xdce(%rip),%rsi
lea    -0x34(%rbp),%rdx
call   1030 <imget_fits_float_value@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xdbd(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1030 <imget_fits_float_value@plt>
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xda5(%rip),%rsi
lea    -0x3c(%rbp),%rdx
call   1030 <imget_fits_float_value@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xd8d(%rip),%rsi
lea    -0x40(%rbp),%rdx
call   1030 <imget_fits_float_value@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
add    %ecx,%eax
cmp    $0x0,%eax
je     1404 <imc_rotate_WCS+0x2d4>
mov    -0x10(%rbp),%rdi
movss  -0x34(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x20(%rbp),%xmm2
movss  -0x3c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xd18(%rip),%rsi
lea    0xd29(%rip),%rdx
lea    0xd3c(%rip),%rcx
call   1050 <imupdate_fitsf@plt>
mov    -0x10(%rbp),%rdi
movss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x20(%rbp),%xmm2
movss  -0x40(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xcc1(%rip),%rsi
lea    0xccc(%rip),%rdx
lea    0xcdf(%rip),%rcx
call   1050 <imupdate_fitsf@plt>
mov    -0x10(%rbp),%rdi
movss  -0x34(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x28(%rbp),%xmm2
movss  -0x3c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xc81(%rip),%rsi
lea    0xc86(%rip),%rdx
lea    0xc99(%rip),%rcx
call   1050 <imupdate_fitsf@plt>
mov    -0x10(%rbp),%rdi
movss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x28(%rbp),%xmm2
movss  -0x40(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xc41(%rip),%rsi
lea    0xc40(%rip),%rdx
lea    0xc53(%rip),%rcx
call   1050 <imupdate_fitsf@plt>
mov    -0x10(%rbp),%rdi
lea    0xc3b(%rip),%rsi
lea    -0x44(%rbp),%rdx
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    15aa <imc_rotate_WCS+0x47a>
mov    -0x10(%rbp),%rdi
lea    0xc27(%rip),%rsi
lea    -0x48(%rbp),%rdx
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    15aa <imc_rotate_WCS+0x47a>
mov    -0x10(%rbp),%rdi
lea    0xc13(%rip),%rsi
lea    -0x4c(%rbp),%rdx
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    15aa <imc_rotate_WCS+0x47a>
mov    -0x10(%rbp),%rdi
lea    0xbff(%rip),%rsi
lea    -0x50(%rbp),%rdx
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    15aa <imc_rotate_WCS+0x47a>
mov    -0x10(%rbp),%rdi
movss  -0x44(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x20(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xb9f(%rip),%rsi
lea    0xb86(%rip),%rdx
lea    0xb99(%rip),%rcx
call   1050 <imupdate_fitsf@plt>
mov    -0x10(%rbp),%rdi
movss  -0x48(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x20(%rbp),%xmm2
movss  -0x50(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xb62(%rip),%rsi
lea    0xb40(%rip),%rdx
lea    0xb53(%rip),%rcx
call   1050 <imupdate_fitsf@plt>
mov    -0x10(%rbp),%rdi
movss  -0x44(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x28(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xb18(%rip),%rsi
lea    0xaed(%rip),%rdx
lea    0xb00(%rip),%rcx
call   1050 <imupdate_fitsf@plt>
mov    -0x10(%rbp),%rdi
movss  -0x48(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x28(%rbp),%xmm2
movss  -0x50(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xace(%rip),%rsi
lea    0xa9a(%rip),%rdx
lea    0xaad(%rip),%rcx
call   1050 <imupdate_fitsf@plt>
mov    -0x10(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xaaf(%rip),%rsi
call   1040 <imaddhistf@plt>
movl   $0x1,-0x4(%rbp)
jmp    15d7 <imc_rotate_WCS+0x4a7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imc_rotate_WCS>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
movsd  %xmm3,(%rsp)
movsd  %xmm2,0x8(%rsp)
movss  %xmm1,0x3c(%rsp)
movss  %xmm0,0x38(%rsp)
mov    %rdi,%r12
lea    0xea3(%rip),%rsi
lea    0x34(%rsp),%rdx
call   1030 <imget_fits_float_value@plt>
xor    %ebp,%ebp
cmp    $0x1,%eax
jne    1530 <imc_rotate_WCS+0x400>
lea    0xe8e(%rip),%rsi
lea    0x30(%rsp),%rdx
mov    %r12,%rdi
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    1530 <imc_rotate_WCS+0x400>
movss  0x34(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x30(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  (%rsp),%xmm1
mulsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
movss  0x38(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
lea    0xe32(%rip),%rsi
lea    0xe39(%rip),%rbp
lea    0xe76(%rip),%r14
mov    %r12,%rdi
mov    %rbp,%rdx
mov    %r14,%rcx
call   1050 <imupdate_fitsf@plt>
movss  0x34(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x30(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0x8(%rsp),%xmm1
mulsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
movss  0x3c(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
lea    0xdde(%rip),%rsi
mov    %r12,%rdi
mov    %rbp,%rdx
mov    %r14,%rcx
call   1050 <imupdate_fitsf@plt>
lea    0xde2(%rip),%rsi
lea    0x2c(%rsp),%rdx
mov    %r12,%rdi
call   1030 <imget_fits_float_value@plt>
mov    %eax,%r14d
lea    0xdd1(%rip),%rsi
lea    0x28(%rsp),%rdx
mov    %r12,%rdi
call   1030 <imget_fits_float_value@plt>
mov    %eax,%ebp
add    %r14d,%ebp
lea    0xdbe(%rip),%rsi
lea    0x24(%rsp),%rdx
mov    %r12,%rdi
call   1030 <imget_fits_float_value@plt>
mov    %eax,%ebx
add    %ebp,%ebx
lea    0xdac(%rip),%rsi
lea    0x20(%rsp),%rdx
mov    %r12,%rdi
call   1030 <imget_fits_float_value@plt>
add    %ebx,%eax
je     1399 <imc_rotate_WCS+0x269>
movss  0x2c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x24(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  (%rsp),%xmm1
mulsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xd57(%rip),%rsi
lea    0xd68(%rip),%r15
lea    0xd7b(%rip),%r14
mov    %r12,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <imupdate_fitsf@plt>
movss  0x28(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x20(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  (%rsp),%xmm1
mulsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xd13(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <imupdate_fitsf@plt>
movss  0x2c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x24(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0x8(%rsp),%xmm1
mulsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xcdd(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <imupdate_fitsf@plt>
movss  0x28(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x20(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0x8(%rsp),%xmm1
mulsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xca7(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <imupdate_fitsf@plt>
lea    0xcaa(%rip),%rsi
lea    0x1c(%rsp),%rdx
mov    %r12,%rdi
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    1511 <imc_rotate_WCS+0x3e1>
lea    0xc96(%rip),%rsi
lea    0x18(%rsp),%rdx
mov    %r12,%rdi
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    1511 <imc_rotate_WCS+0x3e1>
lea    0xc82(%rip),%rsi
lea    0x14(%rsp),%rdx
mov    %r12,%rdi
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    1511 <imc_rotate_WCS+0x3e1>
lea    0xc6e(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %r12,%rdi
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    1511 <imc_rotate_WCS+0x3e1>
movss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x14(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  (%rsp),%xmm1
mulsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xc0f(%rip),%rsi
lea    0xbf6(%rip),%r15
lea    0xc09(%rip),%r14
mov    %r12,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <imupdate_fitsf@plt>
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x10(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  (%rsp),%xmm1
mulsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xbce(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <imupdate_fitsf@plt>
movss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x14(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0x8(%rsp),%xmm1
mulsd  (%rsp),%xmm0
subsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
lea    0xb98(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <imupdate_fitsf@plt>
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x10(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0x8(%rsp),%xmm1
mulsd  (%rsp),%xmm0
subsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
lea    0xb62(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <imupdate_fitsf@plt>
lea    0xb56(%rip),%rsi
mov    %r12,%rdi
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <imaddhistf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.icom = type { i32 }
@.str = [7 x i8] c"CRPIX1\00"
@.str.1 = [7 x i8] c"CRPIX2\00"
@.str.2 = [18 x i8] c"%20.1f / %-47.47s\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [6 x i8] c"CD1_1\00"
@.str.5 = [6 x i8] c"CD1_2\00"
@.str.6 = [6 x i8] c"CD2_1\00"
@.str.7 = [6 x i8] c"CD2_2\00"
@.str.8 = [18 x i8] c"%20.8f / %-47.47s\00"
@.str.9 = [9 x i8] c"PC001001\00"
@.str.10 = [9 x i8] c"PC001002\00"
@.str.11 = [9 x i8] c"PC002001\00"
@.str.12 = [9 x i8] c"PC002002\00"
@.str.13 = [29 x i8] c"WCS is rotated sin=%f cos=%f\00"
define i32 @imc_rotate_WCS(%struct.icom* %0, float %1, float %2, double %3, double %4) {
%6 = alloca i32
%7 = alloca %struct.icom*
%8 = alloca float
%9 = alloca float
%10 = alloca double
%11 = alloca double
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float
%21 = alloca float
store %struct.icom* %0, %struct.icom** %7
store float %1, float* %8
store float %2, float* %9
store double %3, double* %10
store double %4, double* %11
%22 = load %struct.icom*, %struct.icom** %7
%23 = call i32 @imget_fits_float_value(%struct.icom* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float* %12)
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %186
25: ; preds = %5
%26 = load %struct.icom*, %struct.icom** %7
%27 = call i32 @imget_fits_float_value(%struct.icom* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float* %13)
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %186
29: ; preds = %25
%30 = load %struct.icom*, %struct.icom** %7
%31 = load float, float* %12
%32 = fpext float %31 to double
%33 = load double, double* %10
%34 = load float, float* %13
%35 = fpext float %34 to double
%36 = load double, double* %11
%37 = fmul double %35, %36
%38 = fneg double %37
%39 = call double @llvm.fmuladd.f64(double %32, double %33, double %38)
%40 = load float, float* %8
%41 = fpext float %40 to double
%42 = fadd double %39, %41
%43 = fptrunc double %42 to float
%44 = call i32 @imupdate_fitsf(%struct.icom* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), float %43, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%45 = load %struct.icom*, %struct.icom** %7
%46 = load float, float* %12
%47 = fpext float %46 to double
%48 = load double, double* %11
%49 = load float, float* %13
%50 = fpext float %49 to double
%51 = load double, double* %10
%52 = fmul double %50, %51
%53 = call double @llvm.fmuladd.f64(double %47, double %48, double %52)
%54 = load float, float* %9
%55 = fpext float %54 to double
%56 = fadd double %53, %55
%57 = fptrunc double %56 to float
%58 = call i32 @imupdate_fitsf(%struct.icom* %45, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), float %57, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%59 = load %struct.icom*, %struct.icom** %7
%60 = call i32 @imget_fits_float_value(%struct.icom* %59, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), float* %14)
%61 = load %struct.icom*, %struct.icom** %7
%62 = call i32 @imget_fits_float_value(%struct.icom* %61, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), float* %15)
%63 = add nsw i32 %60, %62
%64 = load %struct.icom*, %struct.icom** %7
%65 = call i32 @imget_fits_float_value(%struct.icom* %64, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), float* %16)
%66 = add nsw i32 %63, %65
%67 = load %struct.icom*, %struct.icom** %7
%68 = call i32 @imget_fits_float_value(%struct.icom* %67, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), float* %17)
%69 = add nsw i32 %66, %68
%70 = icmp ne i32 %69, 0
br i1 %70, label %71, label %118
71: ; preds = %29
%72 = load %struct.icom*, %struct.icom** %7
%73 = load float, float* %14
%74 = fpext float %73 to double
%75 = load double, double* %10
%76 = load float, float* %16
%77 = fpext float %76 to double
%78 = load double, double* %11
%79 = fmul double %77, %78
%80 = fneg double %79
%81 = call double @llvm.fmuladd.f64(double %74, double %75, double %80)
%82 = fptrunc double %81 to float
%83 = call i32 @imupdate_fitsf(%struct.icom* %72, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %82, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%84 = load %struct.icom*, %struct.icom** %7
%85 = load float, float* %15
%86 = fpext float %85 to double
%87 = load double, double* %10
%88 = load float, float* %17
%89 = fpext float %88 to double
%90 = load double, double* %11
%91 = fmul double %89, %90
%92 = fneg double %91
%93 = call double @llvm.fmuladd.f64(double %86, double %87, double %92)
%94 = fptrunc double %93 to float
%95 = call i32 @imupdate_fitsf(%struct.icom* %84, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %94, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%96 = load %struct.icom*, %struct.icom** %7
%97 = load float, float* %14
%98 = fpext float %97 to double
%99 = load double, double* %11
%100 = load float, float* %16
%101 = fpext float %100 to double
%102 = load double, double* %10
%103 = fmul double %101, %102
%104 = call double @llvm.fmuladd.f64(double %98, double %99, double %103)
%105 = fptrunc double %104 to float
%106 = call i32 @imupdate_fitsf(%struct.icom* %96, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %105, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%107 = load %struct.icom*, %struct.icom** %7
%108 = load float, float* %15
%109 = fpext float %108 to double
%110 = load double, double* %11
%111 = load float, float* %17
%112 = fpext float %111 to double
%113 = load double, double* %10
%114 = fmul double %112, %113
%115 = call double @llvm.fmuladd.f64(double %109, double %110, double %114)
%116 = fptrunc double %115 to float
%117 = call i32 @imupdate_fitsf(%struct.icom* %107, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %116, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
br label %118
118: ; preds = %71, %29
%119 = load %struct.icom*, %struct.icom** %7
%120 = call i32 @imget_fits_float_value(%struct.icom* %119, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), float* %18)
%121 = icmp eq i32 %120, 1
br i1 %121, label %122, label %181
122: ; preds = %118
%123 = load %struct.icom*, %struct.icom** %7
%124 = call i32 @imget_fits_float_value(%struct.icom* %123, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), float* %19)
%125 = icmp eq i32 %124, 1
br i1 %125, label %126, label %181
126: ; preds = %122
%127 = load %struct.icom*, %struct.icom** %7
%128 = call i32 @imget_fits_float_value(%struct.icom* %127, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), float* %20)
%129 = icmp eq i32 %128, 1
br i1 %129, label %130, label %181
130: ; preds = %126
%131 = load %struct.icom*, %struct.icom** %7
%132 = call i32 @imget_fits_float_value(%struct.icom* %131, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), float* %21)
%133 = icmp eq i32 %132, 1
br i1 %133, label %134, label %181
134: ; preds = %130
%135 = load %struct.icom*, %struct.icom** %7
%136 = load float, float* %18
%137 = fpext float %136 to double
%138 = load double, double* %10
%139 = load float, float* %20
%140 = fpext float %139 to double
%141 = load double, double* %11
%142 = fmul double %140, %141
%143 = call double @llvm.fmuladd.f64(double %137, double %138, double %142)
%144 = fptrunc double %143 to float
%145 = call i32 @imupdate_fitsf(%struct.icom* %135, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %144, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%146 = load %struct.icom*, %struct.icom** %7
%147 = load float, float* %19
%148 = fpext float %147 to double
%149 = load double, double* %10
%150 = load float, float* %21
%151 = fpext float %150 to double
%152 = load double, double* %11
%153 = fmul double %151, %152
%154 = call double @llvm.fmuladd.f64(double %148, double %149, double %153)
%155 = fptrunc double %154 to float
%156 = call i32 @imupdate_fitsf(%struct.icom* %146, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %155, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%157 = load %struct.icom*, %struct.icom** %7
%158 = load float, float* %18
%159 = fneg float %158
%160 = fpext float %159 to double
%161 = load double, double* %11
%162 = load float, float* %20
%163 = fpext float %162 to double
%164 = load double, double* %10
%165 = fmul double %163, %164
%166 = call double @llvm.fmuladd.f64(double %160, double %161, double %165)
%167 = fptrunc double %166 to float
%168 = call i32 @imupdate_fitsf(%struct.icom* %157, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %167, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%169 = load %struct.icom*, %struct.icom** %7
%170 = load float, float* %19
%171 = fneg float %170
%172 = fpext float %171 to double
%173 = load double, double* %11
%174 = load float, float* %21
%175 = fpext float %174 to double
%176 = load double, double* %10
%177 = fmul double %175, %176
%178 = call double @llvm.fmuladd.f64(double %172, double %173, double %177)
%179 = fptrunc double %178 to float
%180 = call i32 @imupdate_fitsf(%struct.icom* %169, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %179, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
br label %181
181: ; preds = %134, %130, %126, %122, %118
%182 = load %struct.icom*, %struct.icom** %7
%183 = load double, double* %11
%184 = load double, double* %10
%185 = call i32 @imaddhistf(%struct.icom* %182, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), double %183, double %184)
store i32 1, i32* %6
br label %187
186: ; preds = %25, %5
store i32 0, i32* %6
br label %187
187: ; preds = %186, %181
%188 = load i32, i32* %6
ret i32 %188
}

LLVM IR (-O2):
%struct.icom = type { i32 }
@.str = [7 x i8] c"CRPIX1\00"
@.str.1 = [7 x i8] c"CRPIX2\00"
@.str.2 = [18 x i8] c"%20.1f / %-47.47s\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [6 x i8] c"CD1_1\00"
@.str.5 = [6 x i8] c"CD1_2\00"
@.str.6 = [6 x i8] c"CD2_1\00"
@.str.7 = [6 x i8] c"CD2_2\00"
@.str.8 = [18 x i8] c"%20.8f / %-47.47s\00"
@.str.9 = [9 x i8] c"PC001001\00"
@.str.10 = [9 x i8] c"PC001002\00"
@.str.11 = [9 x i8] c"PC002001\00"
@.str.12 = [9 x i8] c"PC002002\00"
@.str.13 = [29 x i8] c"WCS is rotated sin=%f cos=%f\00"
define i32 @imc_rotate_WCS(%struct.icom* %0, float %1, float %2, double %3, double %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = bitcast float* %6 to i8*
%17 = bitcast float* %7 to i8*
%18 = bitcast float* %8 to i8*
%19 = bitcast float* %9 to i8*
%20 = bitcast float* %10 to i8*
%21 = bitcast float* %11 to i8*
%22 = bitcast float* %12 to i8*
%23 = bitcast float* %13 to i8*
%24 = bitcast float* %14 to i8*
%25 = bitcast float* %15 to i8*
%26 = call i32 @imget_fits_float_value(%struct.icom* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float* %6)
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %145
28: ; preds = %5
%29 = call i32 @imget_fits_float_value(%struct.icom* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float* %7)
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %145
31: ; preds = %28
%32 = load float, float* %6
%33 = fpext float %32 to double
%34 = load float, float* %7
%35 = fpext float %34 to double
%36 = fneg double %35
%37 = fmul double %36, %4
%38 = call double @llvm.fmuladd.f64(double %33, double %3, double %37)
%39 = fpext float %1 to double
%40 = fadd double %38, %39
%41 = fptrunc double %40 to float
%42 = call i32 @imupdate_fitsf(%struct.icom* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), float %41, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%43 = load float, float* %6
%44 = fpext float %43 to double
%45 = load float, float* %7
%46 = fpext float %45 to double
%47 = fmul double %46, %3
%48 = call double @llvm.fmuladd.f64(double %44, double %4, double %47)
%49 = fpext float %2 to double
%50 = fadd double %48, %49
%51 = fptrunc double %50 to float
%52 = call i32 @imupdate_fitsf(%struct.icom* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), float %51, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%53 = call i32 @imget_fits_float_value(%struct.icom* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), float* %8)
%54 = call i32 @imget_fits_float_value(%struct.icom* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), float* %9)
%55 = add nsw i32 %54, %53
%56 = call i32 @imget_fits_float_value(%struct.icom* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), float* %10)
%57 = add nsw i32 %55, %56
%58 = call i32 @imget_fits_float_value(%struct.icom* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), float* %11)
%59 = sub i32 0, %58
%60 = icmp eq i32 %57, %59
br i1 %60, label %96, label %61
61: ; preds = %31
%62 = load float, float* %8
%63 = fpext float %62 to double
%64 = load float, float* %10
%65 = fpext float %64 to double
%66 = fneg double %65
%67 = fmul double %66, %4
%68 = call double @llvm.fmuladd.f64(double %63, double %3, double %67)
%69 = fptrunc double %68 to float
%70 = call i32 @imupdate_fitsf(%struct.icom* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %69, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%71 = load float, float* %9
%72 = fpext float %71 to double
%73 = load float, float* %11
%74 = fpext float %73 to double
%75 = fneg double %74
%76 = fmul double %75, %4
%77 = call double @llvm.fmuladd.f64(double %72, double %3, double %76)
%78 = fptrunc double %77 to float
%79 = call i32 @imupdate_fitsf(%struct.icom* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %78, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%80 = load float, float* %8
%81 = fpext float %80 to double
%82 = load float, float* %10
%83 = fpext float %82 to double
%84 = fmul double %83, %3
%85 = call double @llvm.fmuladd.f64(double %81, double %4, double %84)
%86 = fptrunc double %85 to float
%87 = call i32 @imupdate_fitsf(%struct.icom* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %86, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%88 = load float, float* %9
%89 = fpext float %88 to double
%90 = load float, float* %11
%91 = fpext float %90 to double
%92 = fmul double %91, %3
%93 = call double @llvm.fmuladd.f64(double %89, double %4, double %92)
%94 = fptrunc double %93 to float
%95 = call i32 @imupdate_fitsf(%struct.icom* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %94, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
br label %96
96: ; preds = %61, %31
%97 = call i32 @imget_fits_float_value(%struct.icom* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), float* %12)
%98 = icmp eq i32 %97, 1
br i1 %98, label %99, label %143
99: ; preds = %96
%100 = call i32 @imget_fits_float_value(%struct.icom* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), float* %13)
%101 = icmp eq i32 %100, 1
br i1 %101, label %102, label %143
102: ; preds = %99
%103 = call i32 @imget_fits_float_value(%struct.icom* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), float* %14)
%104 = icmp eq i32 %103, 1
br i1 %104, label %105, label %143
105: ; preds = %102
%106 = call i32 @imget_fits_float_value(%struct.icom* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), float* %15)
%107 = icmp eq i32 %106, 1
br i1 %107, label %108, label %143
108: ; preds = %105
%109 = load float, float* %12
%110 = fpext float %109 to double
%111 = load float, float* %14
%112 = fpext float %111 to double
%113 = fmul double %112, %4
%114 = call double @llvm.fmuladd.f64(double %110, double %3, double %113)
%115 = fptrunc double %114 to float
%116 = call i32 @imupdate_fitsf(%struct.icom* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %115, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%117 = load float, float* %13
%118 = fpext float %117 to double
%119 = load float, float* %15
%120 = fpext float %119 to double
%121 = fmul double %120, %4
%122 = call double @llvm.fmuladd.f64(double %118, double %3, double %121)
%123 = fptrunc double %122 to float
%124 = call i32 @imupdate_fitsf(%struct.icom* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %123, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%125 = load float, float* %12
%126 = fneg float %125
%127 = fpext float %126 to double
%128 = load float, float* %14
%129 = fpext float %128 to double
%130 = fmul double %129, %3
%131 = call double @llvm.fmuladd.f64(double %127, double %4, double %130)
%132 = fptrunc double %131 to float
%133 = call i32 @imupdate_fitsf(%struct.icom* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %132, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%134 = load float, float* %13
%135 = fneg float %134
%136 = fpext float %135 to double
%137 = load float, float* %15
%138 = fpext float %137 to double
%139 = fmul double %138, %3
%140 = call double @llvm.fmuladd.f64(double %136, double %4, double %139)
%141 = fptrunc double %140 to float
%142 = call i32 @imupdate_fitsf(%struct.icom* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), float %141, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
br label %143
143: ; preds = %108, %105, %102, %99, %96
%144 = call i32 @imaddhistf(%struct.icom* %0, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), double %4, double %3)
br label %145
145: ; preds = %5, %28, %143
%146 = phi i32 [ 1, %143 ], [ 0, %28 ], [ 0, %5 ]
ret i32 %146
}