#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 wcsprm {
  int dummy;
};

/* Variables and functions */
int cdfix(struct wcsprm *);
int celfix(struct wcsprm *);
int cylfix(int const *, struct wcsprm *);
int datfix(struct wcsprm *);
int spcfix(struct wcsprm *);
int unitfix(int, struct wcsprm *);
int wcsfix(int ctrl, const int naxis[], struct wcsprm *wcs, int stat[]) {
  int status = 0;
  if ((stat[0] = cdfix(wcs)) > 0) {
    status = 1;
  }
  if ((stat[1] = datfix(wcs)) > 0) {
    status = 1;
  }
  if ((stat[2] = unitfix(ctrl, wcs)) > 0) {
    status = 1;
  }
  if ((stat[3] = spcfix(wcs)) > 0) {
    status = 1;
  }
  if ((stat[4] = celfix(wcs)) > 0) {
    status = 1;
  }
  if ((stat[5] = cylfix(naxis, wcs)) > 0) {
    status = 1;
  }
  return status;
}


x86 assembly (clang, -O0):
<wcsfix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <cdfix@plt>
mov    -0x20(%rbp),%rcx
mov    %eax,(%rcx)
cmp    $0x0,%eax
jle    119d <wcsfix+0x3d>
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <datfix@plt>
mov    -0x20(%rbp),%rcx
mov    %eax,0x4(%rcx)
cmp    $0x0,%eax
jle    11bd <wcsfix+0x5d>
movl   $0x1,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1060 <unitfix@plt>
mov    -0x20(%rbp),%rcx
mov    %eax,0x8(%rcx)
cmp    $0x0,%eax
jle    11e0 <wcsfix+0x80>
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <spcfix@plt>
mov    -0x20(%rbp),%rcx
mov    %eax,0xc(%rcx)
cmp    $0x0,%eax
jle    1200 <wcsfix+0xa0>
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <celfix@plt>
mov    -0x20(%rbp),%rcx
mov    %eax,0x10(%rcx)
cmp    $0x0,%eax
jle    1220 <wcsfix+0xc0>
movl   $0x1,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <cylfix@plt>
mov    -0x20(%rbp),%rcx
mov    %eax,0x14(%rcx)
cmp    $0x0,%eax
jle    1244 <wcsfix+0xe4>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsfix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,0x10(%rsp)
mov    %edi,%ebp
mov    %rdx,%rdi
call   1040 <cdfix@plt>
mov    %eax,(%r14)
test   %eax,%eax
setg   0xf(%rsp)
mov    %rbx,%rdi
call   1030 <datfix@plt>
mov    %eax,0x4(%r14)
test   %eax,%eax
setg   %r13b
mov    %ebp,%edi
mov    %rbx,%rsi
call   1060 <unitfix@plt>
mov    %eax,0x8(%r14)
test   %eax,%eax
setg   %bpl
mov    %rbx,%rdi
call   1050 <spcfix@plt>
mov    %eax,0xc(%r14)
test   %eax,%eax
setg   %r12b
mov    %rbx,%rdi
call   1070 <celfix@plt>
mov    %eax,0x10(%r14)
test   %eax,%eax
setg   %r15b
mov    0x10(%rsp),%rdi
mov    %rbx,%rsi
call   1080 <cylfix@plt>
mov    %eax,0x14(%r14)
test   %eax,%eax
setg   %al
or     %r15b,%al
or     %bpl,%r12b
or     %al,%r12b
or     0xf(%rsp),%r13b
or     %r12b,%r13b
movzbl %r13b,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.wcsprm = type { i32 }
define i32 @wcsfix(i32 %0, i32* %1, %struct.wcsprm* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca %struct.wcsprm*
%8 = alloca i32*
%9 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store %struct.wcsprm* %2, %struct.wcsprm** %7
store i32* %3, i32** %8
store i32 0, i32* %9
%10 = load %struct.wcsprm*, %struct.wcsprm** %7
%11 = call i32 @cdfix(%struct.wcsprm* %10)
%12 = load i32*, i32** %8
%13 = getelementptr inbounds i32, i32* %12, i64 0
store i32 %11, i32* %13
%14 = icmp sgt i32 %11, 0
br i1 %14, label %15, label %16
15: ; preds = %4
store i32 1, i32* %9
br label %16
16: ; preds = %15, %4
%17 = load %struct.wcsprm*, %struct.wcsprm** %7
%18 = call i32 @datfix(%struct.wcsprm* %17)
%19 = load i32*, i32** %8
%20 = getelementptr inbounds i32, i32* %19, i64 1
store i32 %18, i32* %20
%21 = icmp sgt i32 %18, 0
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 1, i32* %9
br label %23
23: ; preds = %22, %16
%24 = load i32, i32* %5
%25 = load %struct.wcsprm*, %struct.wcsprm** %7
%26 = call i32 @unitfix(i32 %24, %struct.wcsprm* %25)
%27 = load i32*, i32** %8
%28 = getelementptr inbounds i32, i32* %27, i64 2
store i32 %26, i32* %28
%29 = icmp sgt i32 %26, 0
br i1 %29, label %30, label %31
30: ; preds = %23
store i32 1, i32* %9
br label %31
31: ; preds = %30, %23
%32 = load %struct.wcsprm*, %struct.wcsprm** %7
%33 = call i32 @spcfix(%struct.wcsprm* %32)
%34 = load i32*, i32** %8
%35 = getelementptr inbounds i32, i32* %34, i64 3
store i32 %33, i32* %35
%36 = icmp sgt i32 %33, 0
br i1 %36, label %37, label %38
37: ; preds = %31
store i32 1, i32* %9
br label %38
38: ; preds = %37, %31
%39 = load %struct.wcsprm*, %struct.wcsprm** %7
%40 = call i32 @celfix(%struct.wcsprm* %39)
%41 = load i32*, i32** %8
%42 = getelementptr inbounds i32, i32* %41, i64 4
store i32 %40, i32* %42
%43 = icmp sgt i32 %40, 0
br i1 %43, label %44, label %45
44: ; preds = %38
store i32 1, i32* %9
br label %45
45: ; preds = %44, %38
%46 = load i32*, i32** %6
%47 = load %struct.wcsprm*, %struct.wcsprm** %7
%48 = call i32 @cylfix(i32* %46, %struct.wcsprm* %47)
%49 = load i32*, i32** %8
%50 = getelementptr inbounds i32, i32* %49, i64 5
store i32 %48, i32* %50
%51 = icmp sgt i32 %48, 0
br i1 %51, label %52, label %53
52: ; preds = %45
store i32 1, i32* %9
br label %53
53: ; preds = %52, %45
%54 = load i32, i32* %9
ret i32 %54
}

LLVM IR (-O2):
%struct.wcsprm = type { i32 }
define i32 @wcsfix(i32 %0, i32* %1, %struct.wcsprm* %2, i32* nocapture writeonly %3) {
%5 = tail call i32 @cdfix(%struct.wcsprm* %2)
store i32 %5, i32* %3
%6 = icmp sgt i32 %5, 0
%7 = tail call i32 @datfix(%struct.wcsprm* %2)
%8 = getelementptr inbounds i32, i32* %3, i64 1
store i32 %7, i32* %8
%9 = icmp sgt i32 %7, 0
%10 = tail call i32 @unitfix(i32 %0, %struct.wcsprm* %2)
%11 = getelementptr inbounds i32, i32* %3, i64 2
store i32 %10, i32* %11
%12 = icmp sgt i32 %10, 0
%13 = tail call i32 @spcfix(%struct.wcsprm* %2)
%14 = getelementptr inbounds i32, i32* %3, i64 3
store i32 %13, i32* %14
%15 = icmp sgt i32 %13, 0
%16 = tail call i32 @celfix(%struct.wcsprm* %2)
%17 = getelementptr inbounds i32, i32* %3, i64 4
store i32 %16, i32* %17
%18 = icmp sgt i32 %16, 0
%19 = tail call i32 @cylfix(i32* %1, %struct.wcsprm* %2)
%20 = getelementptr inbounds i32, i32* %3, i64 5
store i32 %19, i32* %20
%21 = icmp sgt i32 %19, 0
%22 = select i1 %21, i1 true, i1 %18
%23 = select i1 %22, i1 true, i1 %15
%24 = select i1 %23, i1 true, i1 %12
%25 = select i1 %24, i1 true, i1 %9
%26 = select i1 %25, i1 true, i1 %6
%27 = zext i1 %26 to i32
ret i32 %27
}