#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ get_fp(int, int, int, int, int, int, int, int, double **,
                          double **, int *, double *, double, double **,
                          double **);
int get_ixyz(double **, double);
double get_rcov(int);
int /*<<< orphan*/ stderr;
void get_fp_periodic(int flag, int log, int lmax, int nat, int ntyp,
                     int types[], double lat[3][3], double rxyz[][3],
                     int znucl[], int natx, double cutoff, double **sfp,
                     double **lfp) {
  int i, ixyz;
  double rcov[nat];
  int lseg, l;
  if (lmax == 0) {
    lseg = 1;
    l = 1;
  } else if (lmax == 1) {
    lseg = 4;
    l = 2;
  } else {
    fprintf(stderr, "Error: ORBITAL.");
    exit(1);
  }
  for (i = 0; i < nat; i++) {
    rcov[i] = get_rcov(znucl[types[i] - 1]);
  }
  ixyz = get_ixyz(lat, cutoff);
  get_fp(flag, log, nat, ntyp, ixyz, natx, lseg, l, lat, rxyz, types, rcov,
         cutoff, lfp, sfp);
}


x86 assembly (clang, -O0):
<get_fp_periodic>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x2c(%rbp)
mov    %esi,-0x30(%rbp)
mov    %edx,-0x34(%rbp)
mov    %ecx,-0x38(%rbp)
mov    %r8d,-0x3c(%rbp)
mov    %r9,-0x48(%rbp)
movsd  %xmm0,-0x50(%rbp)
mov    -0x38(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x60(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x68(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    11d5 <get_fp_periodic+0x85>
movl   $0x1,-0x6c(%rbp)
movl   $0x1,-0x70(%rbp)
jmp    1216 <get_fp_periodic+0xc6>
cmpl   $0x1,-0x34(%rbp)
jne    11f2 <get_fp_periodic+0xa2>
movl   $0x4,-0x6c(%rbp)
movl   $0x2,-0x70(%rbp)
jmp    1211 <get_fp_periodic+0xc1>
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
lea    0xdfe(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    1216 <get_fp_periodic+0xc6>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1261 <get_fp_periodic+0x111>
mov    0x20(%rbp),%rax
mov    -0x48(%rbp),%rcx
movslq -0x54(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <get_rcov@plt>
mov    -0x78(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    121d <get_fp_periodic+0xcd>
mov    0x10(%rbp),%rdi
movsd  -0x50(%rbp),%xmm0
call   1030 <get_ixyz@plt>
mov    -0x78(%rbp),%r11
mov    %eax,-0x58(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x38(%rbp),%edx
mov    -0x3c(%rbp),%ecx
mov    -0x58(%rbp),%r8d
mov    0x28(%rbp),%r9d
mov    -0x6c(%rbp),%r13d
mov    -0x70(%rbp),%r12d
mov    0x10(%rbp),%r15
mov    0x18(%rbp),%r14
mov    -0x48(%rbp),%rbx
movsd  -0x50(%rbp),%xmm0
mov    0x38(%rbp),%r10
mov    0x30(%rbp),%rax
sub    $0x40,%rsp
mov    %r13d,(%rsp)
mov    %r12d,0x8(%rsp)
mov    %r15,0x10(%rsp)
mov    %r14,0x18(%rsp)
mov    %rbx,0x20(%rsp)
mov    %r11,0x28(%rsp)
mov    %r10,0x30(%rsp)
mov    %rax,0x38(%rsp)
call   1060 <get_fp@plt>
add    $0x40,%rsp
mov    -0x60(%rbp),%rax
mov    %rax,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_fp_periodic>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm0,-0x40(%rbp)
mov    %r9,%rbx
mov    %ecx,%r14d
mov    %rsp,%r12
lea    0xf(,%r14,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    $0x1,%r9d
mov    $0x1,%eax
test   %edx,%edx
je     11a4 <get_fp_periodic+0x54>
cmp    $0x1,%edx
jne    123e <get_fp_periodic+0xee>
mov    $0x2,%eax
mov    $0x4,%r9d
mov    %rax,-0x48(%rbp)
mov    %r9,-0x50(%rbp)
mov    %edi,-0x2c(%rbp)
mov    %esi,-0x30(%rbp)
mov    %r8d,-0x38(%rbp)
mov    %ecx,-0x34(%rbp)
test   %ecx,%ecx
jle    11ed <get_fp_periodic+0x9d>
mov    0x20(%rbp),%r13
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq (%rbx,%r15,4),%rax
mov    -0x4(%r13,%rax,4),%edi
call   1040 <get_rcov@plt>
movsd  %xmm0,(%r12,%r15,8)
add    $0x1,%r15
cmp    %r15,%r14
jne    11d0 <get_fp_periodic+0x80>
mov    0x10(%rbp),%r14
mov    %r14,%rdi
movsd  -0x40(%rbp),%xmm0
call   1030 <get_ixyz@plt>
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    %eax,%r8d
mov    0x28(%rbp),%r9d
movsd  -0x40(%rbp),%xmm0
push   0x30(%rbp)
push   0x38(%rbp)
push   %r12
push   %rbx
push   0x18(%rbp)
push   %r14
push   -0x48(%rbp)
push   -0x50(%rbp)
call   1060 <get_fp@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
lea    0xdb2(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Error: ORBITAL.\00"
define void @get_fp_periodic(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32* %5, [3 x double]* %6, [3 x double]* %7, i32* %8, i32 %9, double %10, double** %11, double** %12) {
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32*
%20 = alloca [3 x double]*
%21 = alloca [3 x double]*
%22 = alloca i32*
%23 = alloca i32
%24 = alloca double
%25 = alloca double**
%26 = alloca double**
%27 = alloca i32
%28 = alloca i32
%29 = alloca i8*
%30 = alloca i64
%31 = alloca i32
%32 = alloca i32
store i32 %0, i32* %14
store i32 %1, i32* %15
store i32 %2, i32* %16
store i32 %3, i32* %17
store i32 %4, i32* %18
store i32* %5, i32** %19
store [3 x double]* %6, [3 x double]** %20
store [3 x double]* %7, [3 x double]** %21
store i32* %8, i32** %22
store i32 %9, i32* %23
store double %10, double* %24
store double** %11, double*** %25
store double** %12, double*** %26
%33 = load i32, i32* %17
%34 = zext i32 %33 to i64
%35 = call i8* @llvm.stacksave()
store i8* %35, i8** %29
%36 = alloca double, i64 %34
store i64 %34, i64* %30
%37 = load i32, i32* %16
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %13
store i32 1, i32* %31
store i32 1, i32* %32
br label %49
40: ; preds = %13
%41 = load i32, i32* %16
%42 = icmp eq i32 %41, 1
br i1 %42, label %43, label %44
43: ; preds = %40
store i32 4, i32* %31
store i32 2, i32* %32
br label %48
44: ; preds = %40
%45 = load i32, i32* @stderr
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %43
br label %49
49: ; preds = %48, %39
store i32 0, i32* %27
br label %50
50: ; preds = %69, %49
%51 = load i32, i32* %27
%52 = load i32, i32* %17
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %72
54: ; preds = %50
%55 = load i32*, i32** %22
%56 = load i32*, i32** %19
%57 = load i32, i32* %27
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32, i32* %56, i64 %58
%60 = load i32, i32* %59
%61 = sub nsw i32 %60, 1
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %55, i64 %62
%64 = load i32, i32* %63
%65 = call double @get_rcov(i32 %64)
%66 = load i32, i32* %27
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %36, i64 %67
store double %65, double* %68
br label %69
69: ; preds = %54
%70 = load i32, i32* %27
%71 = add nsw i32 %70, 1
store i32 %71, i32* %27
br label %50
72: ; preds = %50
%73 = load [3 x double]*, [3 x double]** %20
%74 = bitcast [3 x double]* %73 to double**
%75 = load double, double* %24
%76 = call i32 @get_ixyz(double** %74, double %75)
store i32 %76, i32* %28
%77 = load i32, i32* %14
%78 = load i32, i32* %15
%79 = load i32, i32* %17
%80 = load i32, i32* %18
%81 = load i32, i32* %28
%82 = load i32, i32* %23
%83 = load i32, i32* %31
%84 = load i32, i32* %32
%85 = load [3 x double]*, [3 x double]** %20
%86 = bitcast [3 x double]* %85 to double**
%87 = load [3 x double]*, [3 x double]** %21
%88 = bitcast [3 x double]* %87 to double**
%89 = load i32*, i32** %19
%90 = load double, double* %24
%91 = load double**, double*** %26
%92 = load double**, double*** %25
%93 = call i32 @get_fp(i32 %77, i32 %78, i32 %79, i32 %80, i32 %81, i32 %82, i32 %83, i32 %84, double** %86, double** %88, i32* %89, double* %36, double %90, double** %91, double** %92)
%94 = load i8*, i8** %29
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Error: ORBITAL.\00"
define void @get_fp_periodic(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32* %5, [3 x double]* %6, [3 x double]* %7, i32* nocapture %8, i32 %9, double %10, double** %11, double** %12) {
%14 = zext i32 %3 to i64
%15 = alloca double, i64 %14
switch i32 %2, label %17 [
i32 0, label %21
i32 1, label %16
]
16: ; preds = %13
br label %21
17: ; preds = %13
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%20 = tail call i32 @exit(i32 1)
unreachable
21: ; preds = %13, %16
%22 = phi i32 [ 4, %16 ], [ 1, %13 ]
%23 = phi i32 [ 2, %16 ], [ 1, %13 ]
%24 = icmp sgt i32 %3, 0
br i1 %24, label %25, label %37
25: ; preds = %21, %25
%26 = phi i64 [ %35, %25 ], [ 0, %21 ]
%27 = getelementptr inbounds i32, i32* %5, i64 %26
%28 = load i32, i32* %27
%29 = add nsw i32 %28, -1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %8, i64 %30
%32 = load i32, i32* %31
%33 = tail call double @get_rcov(i32 %32)
%34 = getelementptr inbounds double, double* %15, i64 %26
store double %33, double* %34
%35 = add nuw nsw i64 %26, 1
%36 = icmp eq i64 %35, %14
br i1 %36, label %37, label %25
37: ; preds = %25, %21
%38 = bitcast [3 x double]* %6 to double**
%39 = tail call i32 @get_ixyz(double** %38, double %10)
%40 = bitcast [3 x double]* %7 to double**
%41 = call i32 @get_fp(i32 %0, i32 %1, i32 %3, i32 %4, i32 %39, i32 %9, i32 %22, i32 %23, double** %38, double** %40, i32* %5, double* %15, double %10, double** %12, double** %11)
ret void
}