#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 */
typedef double complex;

/* Variables and functions */
double I;
double cimag(double);
double creal(double);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ inmzpd_(double *, double *, double *, double *, int *, int *,
                           double *, double *, int *);
void *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
complex gpdf_inm(complex za, double zb, double bi, int n, int m) {
  complex res;
  double zr = creal(za);
  double zi = cimag(za);
  double *cyr = malloc(sizeof(double) * 1);
  double *cyi = malloc(sizeof(double) * 1);
  int *flag = malloc(sizeof(int) * 1);
  inmzpd_(&zr, &zi, &zb, &bi, &n, &m, cyr, cyi, flag);
  if (flag[0] != 0) {
    printf("error in inmzpd!\n");
    printf("za=(%f,%f)\n", creal(za), cimag(za));
    exit(-1);
  }
  res = cyr[0] + I * cyi[0];
  free(cyr);
  free(cyi);
  return res;
}


x86 assembly (clang, -O0):
<gpdf_inm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <creal@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <cimag@plt>
movsd  %xmm0,-0x38(%rbp)
mov    $0x8,%edi
call   1080 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    $0x8,%edi
call   1080 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    $0x4,%edi
call   1080 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%r11
mov    -0x48(%rbp),%r10
mov    -0x50(%rbp),%rax
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x20(%rbp),%r9
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1060 <inmzpd_@plt>
mov    -0x50(%rbp),%rax
cmpl   $0x0,(%rax)
je     1260 <gpdf_inm+0xf0>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x8(%rbp),%xmm0
call   1050 <creal@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <cimag@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
lea    0xdc3(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm1
mov    0x2d79(%rip),%rax
movsd  (%rax),%xmm0
mov    -0x48(%rbp),%rax
movsd  (%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x28(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpdf_inm>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
movsd  %xmm0,0x8(%rsp)
movsd  %xmm1,0x38(%rsp)
movsd  %xmm2,0x30(%rsp)
mov    %edi,0x14(%rsp)
mov    %esi,0x10(%rsp)
call   1060 <creal@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
call   1080 <cimag@plt>
movsd  %xmm0,0x20(%rsp)
mov    $0x8,%edi
call   1090 <malloc@plt>
mov    %rax,%r14
mov    $0x8,%edi
call   1090 <malloc@plt>
mov    %rax,%r15
mov    $0x4,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
sub    $0x8,%rsp
lea    0x30(%rsp),%rdi
lea    0x28(%rsp),%rsi
lea    0x40(%rsp),%rdx
lea    0x38(%rsp),%rcx
lea    0x1c(%rsp),%r8
lea    0x18(%rsp),%r9
push   %rax
push   %r15
push   %r14
call   1070 <inmzpd_@plt>
add    $0x20,%rsp
cmpl   $0x0,(%rbx)
jne    1256 <gpdf_inm+0xd6>
mov    0x2dc6(%rip),%rax
movsd  (%rax),%xmm0
mulsd  (%r15),%xmm0
addsd  (%r14),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
movsd  0x8(%rsp),%xmm0
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xdaf(%rip),%rdi
call   1040 <puts@plt>
movsd  0x8(%rsp),%xmm0
call   1060 <creal@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1080 <cimag@plt>
movaps %xmm0,%xmm1
lea    0xd78(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x2,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"error in inmzpd!\0A\00"
@.str.1 = [12 x i8] c"za=(%f,%f)\0A\00"
@I = global double 0.000000e+00
define double @gpdf_inm(double %0, double %1, double %2, i32 %3, i32 %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double*
%15 = alloca double*
%16 = alloca i32*
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%17 = load double, double* %6
%18 = call double @creal(double %17)
store double %18, double* %12
%19 = load double, double* %6
%20 = call double @cimag(double %19)
store double %20, double* %13
%21 = call i8* @malloc(i32 8)
%22 = bitcast i8* %21 to double*
store double* %22, double** %14
%23 = call i8* @malloc(i32 8)
%24 = bitcast i8* %23 to double*
store double* %24, double** %15
%25 = call i8* @malloc(i32 4)
%26 = bitcast i8* %25 to i32*
store i32* %26, i32** %16
%27 = load double*, double** %14
%28 = load double*, double** %15
%29 = load i32*, i32** %16
%30 = call i32 @inmzpd_(double* %12, double* %13, double* %7, double* %8, i32* %9, i32* %10, double* %27, double* %28, i32* %29)
%31 = load i32*, i32** %16
%32 = getelementptr inbounds i32, i32* %31, i64 0
%33 = load i32, i32* %32
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %43
35: ; preds = %5
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%37 = load double, double* %6
%38 = call double @creal(double %37)
%39 = load double, double* %6
%40 = call double @cimag(double %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %38, double %40)
%42 = call i32 @exit(i32 -1)
unreachable
43: ; preds = %5
%44 = load double*, double** %14
%45 = getelementptr inbounds double, double* %44, i64 0
%46 = load double, double* %45
%47 = load double, double* @I
%48 = load double*, double** %15
%49 = getelementptr inbounds double, double* %48, i64 0
%50 = load double, double* %49
%51 = call double @llvm.fmuladd.f64(double %47, double %50, double %46)
store double %51, double* %11
%52 = load double*, double** %14
%53 = call i32 @free(double* %52)
%54 = load double*, double** %15
%55 = call i32 @free(double* %54)
%56 = load double, double* %11
ret double %56
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"za=(%f,%f)\0A\00"
@I = global double 0.000000e+00
@str = [17 x i8] c"error in inmzpd!\00"
define double @gpdf_inm(double %0, double %1, double %2, i32 %3, i32 %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
store double %1, double* %6
store double %2, double* %7
store i32 %3, i32* %8
store i32 %4, i32* %9
%12 = bitcast double* %10 to i8*
%13 = tail call double @creal(double %0)
store double %13, double* %10
%14 = bitcast double* %11 to i8*
%15 = tail call double @cimag(double %0)
store double %15, double* %11
%16 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%17 = bitcast i8* %16 to double*
%18 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%19 = bitcast i8* %18 to double*
%20 = tail call dereferenceable_or_null(4) i8* @malloc(i32 4)
%21 = bitcast i8* %20 to i32*
%22 = call i32 @inmzpd_(double* %10, double* %11, double* %6, double* %7, i32* %8, i32* %9, double* %17, double* %19, i32* %21)
%23 = load i32, i32* %21
%24 = icmp eq i32 %23, 0
br i1 %24, label %31, label %25
25: ; preds = %5
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%27 = call double @creal(double %0)
%28 = call double @cimag(double %0)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %27, double %28)
%30 = call i32 @exit(i32 -1)
unreachable
31: ; preds = %5
%32 = load double, double* %17
%33 = load double, double* @I
%34 = load double, double* %19
%35 = call double @llvm.fmuladd.f64(double %33, double %34, double %32)
%36 = call i32 @free(double* %17)
%37 = call i32 @free(double* %19)
ret double %35
}