#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 get_nxny_(unsigned char **, unsigned int *, unsigned int *, unsigned int *,
              int *, int *);
int get_nxny(unsigned char **sec, int *nx, int *ny, unsigned int *npnts,
             int *res, int *scan) {
  unsigned int nxx, nyy;
  int err;
  err = get_nxny_(sec, &nxx, &nyy, npnts, res, scan);
  *nx = nxx == 0 ? -1 : nxx;
  *ny = nyy == 0 ? -1 : nyy;
  return err;
}


x86 assembly (clang, -O0):
<get_nxny>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
lea    -0x34(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1030 <get_nxny_@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    1167 <get_nxny+0x57>
mov    $0xffffffff,%eax
mov    %eax,-0x40(%rbp)
jmp    116d <get_nxny+0x5d>
mov    -0x34(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x38(%rbp)
jne    118d <get_nxny+0x7d>
mov    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
jmp    1193 <get_nxny+0x83>
mov    -0x38(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x3c(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_nxny>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1030 <get_nxny_@plt>
mov    0x4(%rsp),%ecx
cmp    $0x1,%ecx
sbb    %edx,%edx
or     %ecx,%edx
mov    %edx,(%rbx)
mov    (%rsp),%ecx
cmp    $0x1,%ecx
sbb    %edx,%edx
or     %ecx,%edx
mov    %edx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @get_nxny(i8** %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5) {
%7 = alloca i8**
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i8** %0, i8*** %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%16 = load i8**, i8*** %7
%17 = load i32*, i32** %10
%18 = load i32*, i32** %11
%19 = load i32*, i32** %12
%20 = call i32 @get_nxny_(i8** %16, i32* %13, i32* %14, i32* %17, i32* %18, i32* %19)
store i32 %20, i32* %15
%21 = load i32, i32* %13
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %6
br label %26
24: ; preds = %6
%25 = load i32, i32* %13
br label %26
26: ; preds = %24, %23
%27 = phi i32 [ -1, %23 ], [ %25, %24 ]
%28 = load i32*, i32** %8
store i32 %27, i32* %28
%29 = load i32, i32* %14
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %26
br label %34
32: ; preds = %26
%33 = load i32, i32* %14
br label %34
34: ; preds = %32, %31
%35 = phi i32 [ -1, %31 ], [ %33, %32 ]
%36 = load i32*, i32** %9
store i32 %35, i32* %36
%37 = load i32, i32* %15
ret i32 %37
}

LLVM IR (-O2):
define i32 @get_nxny(i8** %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %7 to i8*
%10 = bitcast i32* %8 to i8*
%11 = call i32 @get_nxny_(i8** %0, i32* %7, i32* %8, i32* %3, i32* %4, i32* %5)
%12 = load i32, i32* %7
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i32 -1, i32 %12
store i32 %14, i32* %1
%15 = load i32, i32* %8
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i32 -1, i32 %15
store i32 %17, i32* %2
ret i32 %11
}