#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 */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ getirafpixname(char const *, char *, char *, int *);
char *irafrdhead(char const *, int *);
int /*<<< orphan*/ remove(char const *);
int fits_delete_iraf_file(const char *filename, int *status) {
  char *irafheader;
  int lenirafhead;
  char pixfilename[255 + 1];
  irafheader = irafrdhead(filename, &lenirafhead);
  if (!irafheader) {
    return (*status = 104);
  }
  getirafpixname(filename, irafheader, pixfilename, status);
  free(irafheader);
  if (*status > 0)
    return (*status);
  remove(filename);
  remove(pixfilename);
  return (*status);
}


x86 assembly (clang, -O0):
<fits_delete_iraf_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1060 <irafrdhead@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1185 <fits_delete_iraf_file+0x45>
mov    -0x18(%rbp),%rax
movl   $0x68,(%rax)
movl   $0x68,-0x4(%rbp)
jmp    11df <fits_delete_iraf_file+0x9f>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x130(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1050 <getirafpixname@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jle    11c1 <fits_delete_iraf_file+0x81>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11df <fits_delete_iraf_file+0x9f>
mov    -0x10(%rbp),%rdi
call   1040 <remove@plt>
lea    -0x130(%rbp),%rdi
call   1040 <remove@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fits_delete_iraf_file>:
push   %r15
push   %r14
push   %rbx
sub    $0x110,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xc(%rsp),%rsi
call   1060 <irafrdhead@plt>
test   %rax,%rax
je     119d <fits_delete_iraf_file+0x5d>
mov    %rax,%rbx
lea    0x10(%rsp),%rdx
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r14,%rcx
call   1050 <getirafpixname@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    (%r14),%eax
test   %eax,%eax
jg     11a9 <fits_delete_iraf_file+0x69>
mov    %r15,%rdi
call   1040 <remove@plt>
lea    0x10(%rsp),%rdi
call   1040 <remove@plt>
mov    (%r14),%eax
jmp    11a9 <fits_delete_iraf_file+0x69>
movl   $0x68,(%r14)
mov    $0x68,%eax
add    $0x110,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @fits_delete_iraf_file(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [256 x i8]
store i8* %0, i8** %4
store i32* %1, i32** %5
%9 = load i8*, i8** %4
%10 = call i8* @irafrdhead(i8* %9, i32* %7)
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = icmp ne i8* %11, null
br i1 %12, label %15, label %13
13: ; preds = %2
%14 = load i32*, i32** %5
store i32 104, i32* %14
store i32 104, i32* %3
br label %36
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = load i8*, i8** %6
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%19 = load i32*, i32** %5
%20 = call i32 @getirafpixname(i8* %16, i8* %17, i8* %18, i32* %19)
%21 = load i8*, i8** %6
%22 = call i32 @free(i8* %21)
%23 = load i32*, i32** %5
%24 = load i32, i32* %23
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %15
%27 = load i32*, i32** %5
%28 = load i32, i32* %27
store i32 %28, i32* %3
br label %36
29: ; preds = %15
%30 = load i8*, i8** %4
%31 = call i32 @remove(i8* %30)
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%33 = call i32 @remove(i8* %32)
%34 = load i32*, i32** %5
%35 = load i32, i32* %34
store i32 %35, i32* %3
br label %36
36: ; preds = %29, %26, %13
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
define i32 @fits_delete_iraf_file(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca [256 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = call i8* @irafrdhead(i8* %0, i32* %3)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 104, i32* %1
br label %19
10: ; preds = %2
%11 = call i32 @getirafpixname(i8* %0, i8* %7, i8* %6, i32* %1)
%12 = call i32 @free(i8* %7)
%13 = load i32, i32* %1
%14 = icmp sgt i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %10
%16 = call i32 @remove(i8* %0)
%17 = call i32 @remove(i8* %6)
%18 = load i32, i32* %1
br label %19
19: ; preds = %10, %15, %9
%20 = phi i32 [ %18, %15 ], [ 104, %9 ], [ %13, %10 ]
ret i32 %20
}