#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*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ genmn(double *, double *, double *);
int /*<<< orphan*/ stderr;
int pgenmn(void) {
  extern double *fwork, *parm;
  if (parm != NULL) {
    long p = (long)*(parm);
    genmn(parm, fwork, fwork + p);
    return 1;
  } else {
    fputs("PGENMN called before PSETMN called successfully - ABORT\n", stderr);
    fputs("parm not properly initialized in PGENMN - ABORT\n", stderr);
    return 0;
  }
}


x86 assembly (clang, -O0):
<pgenmn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
cmpq   $0x0,(%rax)
je     1186 <pgenmn+0x66>
mov    0x2e90(%rip),%rax
mov    (%rax),%rax
cvttsd2si (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e7d(%rip),%rax
mov    (%rax),%rdi
mov    0x2e93(%rip),%rax
mov    (%rax),%rsi
mov    0x2e89(%rip),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
call   1040 <genmn@plt>
movl   $0x1,-0x4(%rbp)
jmp    11b7 <pgenmn+0x97>
mov    0x2e4b(%rip),%rax
mov    (%rax),%esi
lea    0xe6a(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e36(%rip),%rax
mov    (%rax),%esi
lea    0xe8e(%rip),%rdi
call   1030 <fputs@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pgenmn>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%rdi
test   %rdi,%rdi
je     114f <pgenmn+0x2f>
cvttsd2si (%rdi),%rax
mov    0x2eb4(%rip),%rcx
mov    (%rcx),%rsi
lea    (%rsi,%rax,8),%rdx
call   1040 <genmn@plt>
mov    $0x1,%eax
pop    %rbx
ret
mov    0x2e82(%rip),%rbx
mov    (%rbx),%esi
lea    0xea1(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@parm = external global double*
@fwork = external global double*
@.str = [57 x i8] c"PGENMN called before PSETMN called successfully - ABORT\0A\00"
@stderr = global i32 0
@.str.1 = [49 x i8] c"parm not properly initialized in PGENMN - ABORT\0A\00"
define i32 @pgenmn() {
%1 = alloca i32
%2 = alloca i64
%3 = load double*, double** @parm
%4 = icmp ne double* %3, null
br i1 %4, label %5, label %15
5: ; preds = %0
%6 = load double*, double** @parm
%7 = load double, double* %6
%8 = fptosi double %7 to i64
store i64 %8, i64* %2
%9 = load double*, double** @parm
%10 = load double*, double** @fwork
%11 = load double*, double** @fwork
%12 = load i64, i64* %2
%13 = getelementptr inbounds double, double* %11, i64 %12
%14 = call i32 @genmn(double* %9, double* %10, double* %13)
store i32 1, i32* %1
br label %20
15: ; preds = %0
%16 = load i32, i32* @stderr
%17 = call i32 @fputs(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* @stderr
%19 = call i32 @fputs(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 %18)
store i32 0, i32* %1
br label %20
20: ; preds = %15, %5
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@parm = external global double*
@fwork = external global double*
@.str = [57 x i8] c"PGENMN called before PSETMN called successfully - ABORT\0A\00"
@stderr = global i32 0
@.str.1 = [49 x i8] c"parm not properly initialized in PGENMN - ABORT\0A\00"
define i32 @pgenmn() {
%1 = load double*, double** @parm
%2 = icmp eq double* %1, null
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = load double, double* %1
%5 = fptosi double %4 to i64
%6 = load double*, double** @fwork
%7 = getelementptr inbounds double, double* %6, i64 %5
%8 = tail call i32 @genmn(double* %1, double* %6, double* %7)
br label %14
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = tail call i32 @fputs(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* @stderr
%13 = tail call i32 @fputs(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %9, %3
%15 = phi i32 [ 1, %3 ], [ 0, %9 ]
ret i32 %15
}