#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 */
unsigned int cnfFptr(void *);
int cnfRegp(void *);
unsigned int cnf_preg_(void **locptr, int *const isnew) {

  int status;
  unsigned int f77_ptr;
  *isnew = 0;
  f77_ptr = cnfFptr(*locptr);
  if (f77_ptr)
    return f77_ptr;
  status = cnfRegp(*locptr);
  if (status != 1)
    return (unsigned int)0;
  *isnew = 1;
  return cnfFptr(*locptr);
}


x86 assembly (clang, -O0):
<cnf_preg_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <cnfFptr@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     115e <cnf_preg_+0x3e>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    119c <cnf_preg_+0x7c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <cnfRegp@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
je     1183 <cnf_preg_+0x63>
movl   $0x0,-0x4(%rbp)
jmp    119c <cnf_preg_+0x7c>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <cnfFptr@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cnf_preg_>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movl   $0x0,(%rsi)
mov    (%rdi),%rdi
call   1030 <cnfFptr@plt>
test   %eax,%eax
jne    1163 <cnf_preg_+0x43>
mov    (%rbx),%rdi
call   1040 <cnfRegp@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
jne    1163 <cnf_preg_+0x43>
movl   $0x1,(%r14)
mov    (%rbx),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <cnfFptr@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @cnf_preg_(i8** %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i8** %0, i8*** %4
store i32* %1, i32** %5
%8 = load i32*, i32** %5
store i32 0, i32* %8
%9 = load i8**, i8*** %4
%10 = load i8*, i8** %9
%11 = call i32 @cnfFptr(i8* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = load i32, i32* %7
store i32 %15, i32* %3
br label %28
16: ; preds = %2
%17 = load i8**, i8*** %4
%18 = load i8*, i8** %17
%19 = call i32 @cnfRegp(i8* %18)
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, 1
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 0, i32* %3
br label %28
23: ; preds = %16
%24 = load i32*, i32** %5
store i32 1, i32* %24
%25 = load i8**, i8*** %4
%26 = load i8*, i8** %25
%27 = call i32 @cnfFptr(i8* %26)
store i32 %27, i32* %3
br label %28
28: ; preds = %23, %22, %14
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @cnf_preg_(i8** nocapture %0, i32* nocapture writeonly %1) {
store i32 0, i32* %1
%3 = load i8*, i8** %0
%4 = tail call i32 @cnfFptr(i8* %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = load i8*, i8** %0
%8 = tail call i32 @cnfRegp(i8* %7)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %13
10: ; preds = %6
store i32 1, i32* %1
%11 = load i8*, i8** %0
%12 = tail call i32 @cnfFptr(i8* %11)
br label %13
13: ; preds = %6, %2, %10
%14 = phi i32 [ %12, %10 ], [ %4, %2 ], [ 0, %6 ]
ret i32 %14
}