#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 obsfix(int /*<<< orphan*/, 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] = obsfix(0, wcs)) > 0) {
    status = 1;
  }
  if ((stat[3] = unitfix(ctrl, wcs)) > 0) {
    status = 1;
  }
  if ((stat[4] = spcfix(wcs)) > 0) {
    status = 1;
  }
  if ((stat[5] = celfix(wcs)) > 0) {
    status = 1;
  }
  if ((stat[6] = 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    11ad <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    11cd <wcsfix+0x5d>
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1060 <obsfix@plt>
mov    -0x20(%rbp),%rcx
mov    %eax,0x8(%rcx)
cmp    $0x0,%eax
jle    11ef <wcsfix+0x7f>
movl   $0x1,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1070 <unitfix@plt>
mov    -0x20(%rbp),%rcx
mov    %eax,0xc(%rcx)
cmp    $0x0,%eax
jle    1212 <wcsfix+0xa2>
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <spcfix@plt>
mov    -0x20(%rbp),%rcx
mov    %eax,0x10(%rcx)
cmp    $0x0,%eax
jle    1232 <wcsfix+0xc2>
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <celfix@plt>
mov    -0x20(%rbp),%rcx
mov    %eax,0x14(%rcx)
cmp    $0x0,%eax
jle    1252 <wcsfix+0xe2>
movl   $0x1,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1090 <cylfix@plt>
mov    -0x20(%rbp),%rcx
mov    %eax,0x18(%rcx)
cmp    $0x0,%eax
jle    1276 <wcsfix+0x106>
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   0xe(%rsp)
xor    %edi,%edi
mov    %rbx,%rsi
call   1060 <obsfix@plt>
mov    %eax,0x8(%r14)
test   %eax,%eax
setg   %r12b
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <unitfix@plt>
mov    %eax,0xc(%r14)
test   %eax,%eax
setg   %bpl
mov    %rbx,%rdi
call   1050 <spcfix@plt>
mov    %eax,0x10(%r14)
test   %eax,%eax
setg   %r15b
mov    %rbx,%rdi
call   1080 <celfix@plt>
mov    %eax,0x14(%r14)
test   %eax,%eax
setg   %r13b
mov    0x10(%rsp),%rdi
mov    %rbx,%rsi
call   1090 <cylfix@plt>
mov    %eax,0x18(%r14)
test   %eax,%eax
setg   %al
or     %r13b,%al
or     %bpl,%r15b
or     %al,%r15b
or     0xe(%rsp),%r12b
or     %r15b,%r12b
or     0xf(%rsp),%r12b
movzbl %r12b,%eax
and    $0x1,%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 %struct.wcsprm*, %struct.wcsprm** %7
%25 = call i32 @obsfix(i32 0, %struct.wcsprm* %24)
%26 = load i32*, i32** %8
%27 = getelementptr inbounds i32, i32* %26, i64 2
store i32 %25, i32* %27
%28 = icmp sgt i32 %25, 0
br i1 %28, label %29, label %30
29: ; preds = %23
store i32 1, i32* %9
br label %30
30: ; preds = %29, %23
%31 = load i32, i32* %5
%32 = load %struct.wcsprm*, %struct.wcsprm** %7
%33 = call i32 @unitfix(i32 %31, %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 = %30
store i32 1, i32* %9
br label %38
38: ; preds = %37, %30
%39 = load %struct.wcsprm*, %struct.wcsprm** %7
%40 = call i32 @spcfix(%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 %struct.wcsprm*, %struct.wcsprm** %7
%47 = call i32 @celfix(%struct.wcsprm* %46)
%48 = load i32*, i32** %8
%49 = getelementptr inbounds i32, i32* %48, i64 5
store i32 %47, i32* %49
%50 = icmp sgt i32 %47, 0
br i1 %50, label %51, label %52
51: ; preds = %45
store i32 1, i32* %9
br label %52
52: ; preds = %51, %45
%53 = load i32*, i32** %6
%54 = load %struct.wcsprm*, %struct.wcsprm** %7
%55 = call i32 @cylfix(i32* %53, %struct.wcsprm* %54)
%56 = load i32*, i32** %8
%57 = getelementptr inbounds i32, i32* %56, i64 6
store i32 %55, i32* %57
%58 = icmp sgt i32 %55, 0
br i1 %58, label %59, label %60
59: ; preds = %52
store i32 1, i32* %9
br label %60
60: ; preds = %59, %52
%61 = load i32, i32* %9
ret i32 %61
}

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 @obsfix(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 @unitfix(i32 %0, %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 @spcfix(%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 @celfix(%struct.wcsprm* %2)
%20 = getelementptr inbounds i32, i32* %3, i64 5
store i32 %19, i32* %20
%21 = icmp sgt i32 %19, 0
%22 = tail call i32 @cylfix(i32* %1, %struct.wcsprm* %2)
%23 = getelementptr inbounds i32, i32* %3, i64 6
store i32 %22, i32* %23
%24 = icmp sgt i32 %22, 0
%25 = select i1 %24, i1 true, i1 %21
%26 = select i1 %25, i1 true, i1 %18
%27 = select i1 %26, i1 true, i1 %15
%28 = select i1 %27, i1 true, i1 %12
%29 = select i1 %28, i1 true, i1 %9
%30 = select i1 %29, i1 true, i1 %6
%31 = zext i1 %30 to i32
ret i32 %31
}