#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 star {
  int dummy;
};
struct ccd_frame {
  int dummy;
};

/* Variables and functions */
int locate_star(struct ccd_frame *, int, int, double, double, struct star *);
int get_star_near(struct ccd_frame *fr, int x, int y, double min_flux,
                  struct star *s) {
  int ret;
  ret = locate_star(fr, x * 1.0, y * 1.0, 10.0, min_flux, s);
  if (ret != 0)
    return ret;
  return 0;
}


x86 assembly (clang, -O0):
<get_star_near>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xecc(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
cvtsi2sdl -0x18(%rbp),%xmm0
movsd  0xeb7(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
movsd  -0x20(%rbp),%xmm1
mov    -0x28(%rbp),%rcx
movsd  0xe96(%rip),%xmm0
call   1030 <locate_star@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     1187 <get_star_near+0x77>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118e <get_star_near+0x7e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_star_near>:
movaps %xmm0,%xmm1
movsd  0xee5(%rip),%xmm0
jmp    1030 <locate_star@plt>

LLVM IR (-O0):
%struct.ccd_frame = type { i32 }
%struct.star = type { i32 }
define i32 @get_star_near(%struct.ccd_frame* %0, i32 %1, i32 %2, double %3, %struct.star* %4) {
%6 = alloca i32
%7 = alloca %struct.ccd_frame*
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca %struct.star*
%12 = alloca i32
store %struct.ccd_frame* %0, %struct.ccd_frame** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store double %3, double* %10
store %struct.star* %4, %struct.star** %11
%13 = load %struct.ccd_frame*, %struct.ccd_frame** %7
%14 = load i32, i32* %8
%15 = sitofp i32 %14 to double
%16 = fmul double %15, 1.000000e+00
%17 = fptosi double %16 to i32
%18 = load i32, i32* %9
%19 = sitofp i32 %18 to double
%20 = fmul double %19, 1.000000e+00
%21 = fptosi double %20 to i32
%22 = load double, double* %10
%23 = load %struct.star*, %struct.star** %11
%24 = call i32 @locate_star(%struct.ccd_frame* %13, i32 %17, i32 %21, double 1.000000e+01, double %22, %struct.star* %23)
store i32 %24, i32* %12
%25 = load i32, i32* %12
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %5
%28 = load i32, i32* %12
store i32 %28, i32* %6
br label %30
29: ; preds = %5
store i32 0, i32* %6
br label %30
30: ; preds = %29, %27
%31 = load i32, i32* %6
ret i32 %31
}

LLVM IR (-O2):
%struct.ccd_frame = type { i32 }
%struct.star = type { i32 }
define i32 @get_star_near(%struct.ccd_frame* %0, i32 %1, i32 %2, double %3, %struct.star* %4) {
%6 = tail call i32 @locate_star(%struct.ccd_frame* %0, i32 %1, i32 %2, double 1.000000e+01, double %3, %struct.star* %4)
ret i32 %6
}