#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*/ FILE;

/* Variables and functions */
int extract_ucac2_stars(int /*<<< orphan*/ *, double const, double const,
                        double const, double const, char const *, int const);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int extract_ucac2_stars_given_filename(const char *output_filename,
                                       const double ra, const double dec,
                                       const double width, const double height,
                                       const char *path,
                                       const int is_supplement) {
  FILE *ofile = fopen(output_filename, "wb");
  int rval;
  if (!ofile)
    rval = -1;
  else {
    rval =
        extract_ucac2_stars(ofile, ra, dec, width, height, path, is_supplement);
    fclose(ofile);
  }
  return (rval);
}


x86 assembly (clang, -O0):
<extract_ucac2_stars_given_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
mov    %edx,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe9e(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1182 <extract_ucac2_stars_given_filename+0x52>
movl   $0xffffffff,-0x44(%rbp)
jmp    11b2 <extract_ucac2_stars_given_filename+0x82>
mov    -0x40(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
mov    -0x30(%rbp),%rsi
mov    -0x34(%rbp),%edx
call   1050 <extract_ucac2_stars@plt>
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x44(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_ucac2_stars_given_filename>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
lea    0xea4(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     119c <extract_ucac2_stars_given_filename+0x6c>
mov    %rax,%rbp
mov    %rax,%rdi
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
mov    %rbx,%rsi
mov    %r14d,%edx
call   1050 <extract_ucac2_stars@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1030 <fclose@plt>
mov    %ebx,%eax
jmp    11a1 <extract_ucac2_stars_given_filename+0x71>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"wb\00"
define i32 @extract_ucac2_stars_given_filename(i8* %0, double %1, double %2, double %3, double %4, i8* %5, i32 %6) {
%8 = alloca i8*
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32
store i8* %0, i8** %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double %4, double* %12
store i8* %5, i8** %13
store i32 %6, i32* %14
%17 = load i8*, i8** %8
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %18, i32** %15
%19 = load i32*, i32** %15
%20 = icmp ne i32* %19, null
br i1 %20, label %22, label %21
21: ; preds = %7
store i32 -1, i32* %16
br label %33
22: ; preds = %7
%23 = load i32*, i32** %15
%24 = load double, double* %9
%25 = load double, double* %10
%26 = load double, double* %11
%27 = load double, double* %12
%28 = load i8*, i8** %13
%29 = load i32, i32* %14
%30 = call i32 @extract_ucac2_stars(i32* %23, double %24, double %25, double %26, double %27, i8* %28, i32 %29)
store i32 %30, i32* %16
%31 = load i32*, i32** %15
%32 = call i32 @fclose(i32* %31)
br label %33
33: ; preds = %22, %21
%34 = load i32, i32* %16
ret i32 %34
}

LLVM IR (-O2):
@.str = [3 x i8] c"wb\00"
define i32 @extract_ucac2_stars_given_filename(i8* nocapture %0, double %1, double %2, double %3, double %4, i8* %5, i32 %6) {
%8 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = tail call i32 @extract_ucac2_stars(i32* %8, double %1, double %2, double %3, double %4, i8* %5, i32 %6)
%12 = tail call i32 @fclose(i32* %8)
br label %13
13: ; preds = %7, %10
%14 = phi i32 [ %11, %10 ], [ -1, %7 ]
ret i32 %14
}