#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 *, float, float);
int imget_fits_float_value(struct icom *, char *, float *);
int /*<<< orphan*/ imupdate_fitsf(struct icom *, char *, char *, float, char *);
int imc_shift_WCS(struct icom *icom, float dx, float dy) {
  float crpix1, crpix2;
  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 - dx,
                   "Reference pixel coordinate system in axis1");
    imupdate_fitsf(icom, "CRPIX2", "%20.1f / %-47.47s", crpix2 - dy,
                   "Reference pixel coordinate system in axis2");
    imaddhistf(icom, "WCS is shifted by %f,%f", dx, dy);
    return 1;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<imc_shift_WCS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeaf(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    11f6 <imc_shift_WCS+0xc6>
mov    -0x10(%rbp),%rdi
lea    0xe99(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    11f6 <imc_shift_WCS+0xc6>
mov    -0x10(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
lea    0xe6b(%rip),%rsi
lea    0xe72(%rip),%rdx
lea    0xe7d(%rip),%rcx
call   1050 <imupdate_fitsf@plt>
mov    -0x10(%rbp),%rdi
movss  -0x20(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
lea    0xe4a(%rip),%rsi
lea    0xe4a(%rip),%rdx
lea    0xe80(%rip),%rcx
call   1050 <imupdate_fitsf@plt>
mov    -0x10(%rbp),%rdi
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
lea    0xe91(%rip),%rsi
call   1040 <imaddhistf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11fd <imc_shift_WCS+0xcd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imc_shift_WCS>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
lea    0xeb4(%rip),%rsi
lea    0x14(%rsp),%rdx
call   1030 <imget_fits_float_value@plt>
xor    %ebp,%ebp
cmp    $0x1,%eax
jne    11eb <imc_shift_WCS+0xbb>
lea    0xe9f(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
call   1030 <imget_fits_float_value@plt>
cmp    $0x1,%eax
jne    11eb <imc_shift_WCS+0xbb>
movss  0x14(%rsp),%xmm0
subss  0x8(%rsp),%xmm0
lea    0xe73(%rip),%rsi
lea    0xe7a(%rip),%rbp
lea    0xe85(%rip),%rcx
mov    %rbx,%rdi
mov    %rbp,%rdx
call   1050 <imupdate_fitsf@plt>
movss  0x10(%rsp),%xmm0
subss  0xc(%rsp),%xmm0
lea    0xe4e(%rip),%rsi
lea    0xe8b(%rip),%rcx
mov    %rbx,%rdi
mov    %rbp,%rdx
call   1050 <imupdate_fitsf@plt>
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1040 <imaddhistf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
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 = [43 x i8] c"Reference pixel coordinate system in axis1\00"
@.str.4 = [43 x i8] c"Reference pixel coordinate system in axis2\00"
@.str.5 = [24 x i8] c"WCS is shifted by %f,%f\00"
define i32 @imc_shift_WCS(%struct.icom* %0, float %1, float %2) {
%4 = alloca i32
%5 = alloca %struct.icom*
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store %struct.icom* %0, %struct.icom** %5
store float %1, float* %6
store float %2, float* %7
%10 = load %struct.icom*, %struct.icom** %5
%11 = call i32 @imget_fits_float_value(%struct.icom* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float* %8)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %32
13: ; preds = %3
%14 = load %struct.icom*, %struct.icom** %5
%15 = call i32 @imget_fits_float_value(%struct.icom* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float* %9)
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %32
17: ; preds = %13
%18 = load %struct.icom*, %struct.icom** %5
%19 = load float, float* %8
%20 = load float, float* %6
%21 = fsub float %19, %20
%22 = call i32 @imupdate_fitsf(%struct.icom* %18, 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 %21, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%23 = load %struct.icom*, %struct.icom** %5
%24 = load float, float* %9
%25 = load float, float* %7
%26 = fsub float %24, %25
%27 = call i32 @imupdate_fitsf(%struct.icom* %23, 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 %26, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%28 = load %struct.icom*, %struct.icom** %5
%29 = load float, float* %6
%30 = load float, float* %7
%31 = call i32 @imaddhistf(%struct.icom* %28, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), float %29, float %30)
store i32 1, i32* %4
br label %33
32: ; preds = %13, %3
store i32 0, i32* %4
br label %33
33: ; preds = %32, %17
%34 = load i32, i32* %4
ret i32 %34
}

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 = [43 x i8] c"Reference pixel coordinate system in axis1\00"
@.str.4 = [43 x i8] c"Reference pixel coordinate system in axis2\00"
@.str.5 = [24 x i8] c"WCS is shifted by %f,%f\00"
define i32 @imc_shift_WCS(%struct.icom* %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = bitcast float* %4 to i8*
%7 = bitcast float* %5 to i8*
%8 = call i32 @imget_fits_float_value(%struct.icom* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float* %4)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %21
10: ; preds = %3
%11 = 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* %5)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load float, float* %4
%15 = fsub float %14, %1
%16 = 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 %15, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%17 = load float, float* %5
%18 = fsub float %17, %2
%19 = 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 %18, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @imaddhistf(%struct.icom* %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), float %1, float %2)
br label %21
21: ; preds = %3, %10, %13
%22 = phi i32 [ 1, %13 ], [ 0, %10 ], [ 0, %3 ]
ret i32 %22
}