#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 __cvmx_helper_initialize_fpa_pool(int, int, int, char *);
int /*<<< orphan*/ cvmx_fpa_enable();
int /*<<< orphan*/ printf(char *, int);
int __cvmx_helper_initialize_fpa(int pip_pool, int pip_size, int pip_buffers,
                                 int wqe_pool, int wqe_size, int wqe_entries,
                                 int pko_pool, int pko_size, int pko_buffers,
                                 int tim_pool, int tim_size, int tim_buffers,
                                 int dfa_pool, int dfa_size, int dfa_buffers) {
  int status;
  cvmx_fpa_enable();
  if ((pip_buffers > 0) && (pip_buffers <= 64))
    printf("Warning: %d packet buffers may not be enough for hardware"
           " prefetch. 65 or more is recommended.\n",
           pip_buffers);
  if (pip_pool >= 0) {
    status = __cvmx_helper_initialize_fpa_pool(pip_pool, pip_size, pip_buffers,
                                               "Packet Buffers");
    if (status)
      return status;
  }
  if (wqe_pool >= 0) {
    status = __cvmx_helper_initialize_fpa_pool(wqe_pool, wqe_size, wqe_entries,
                                               "Work Queue Entries");
    if (status)
      return status;
  }
  if (pko_pool >= 0) {
    status = __cvmx_helper_initialize_fpa_pool(pko_pool, pko_size, pko_buffers,
                                               "PKO Command Buffers");
    if (status)
      return status;
  }
  if (tim_pool >= 0) {
    status = __cvmx_helper_initialize_fpa_pool(tim_pool, tim_size, tim_buffers,
                                               "TIM Command Buffers");
    if (status)
      return status;
  }
  if (dfa_pool >= 0) {
    status = __cvmx_helper_initialize_fpa_pool(dfa_pool, dfa_size, dfa_buffers,
                                               "DFA Command Buffers");
    if (status)
      return status;
  }
  return 0;
}


x86 assembly (clang, -O0):
<__cvmx_helper_initialize_fpa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x50(%rbp),%eax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    $0x0,%al
call   1050 <cvmx_fpa_enable@plt>
cmpl   $0x0,-0x10(%rbp)
jle    1191 <__cvmx_helper_initialize_fpa+0x61>
cmpl   $0x40,-0x10(%rbp)
jg     1191 <__cvmx_helper_initialize_fpa+0x61>
mov    -0x10(%rbp),%esi
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jl     11cd <__cvmx_helper_initialize_fpa+0x9d>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xeb5(%rip),%rcx
call   1040 <__cvmx_helper_initialize_fpa_pool@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     11c8 <__cvmx_helper_initialize_fpa+0x98>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12c4 <__cvmx_helper_initialize_fpa+0x194>
jmp    11cd <__cvmx_helper_initialize_fpa+0x9d>
cmpl   $0x0,-0x14(%rbp)
jl     1209 <__cvmx_helper_initialize_fpa+0xd9>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe88(%rip),%rcx
call   1040 <__cvmx_helper_initialize_fpa_pool@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1204 <__cvmx_helper_initialize_fpa+0xd4>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12c4 <__cvmx_helper_initialize_fpa+0x194>
jmp    1209 <__cvmx_helper_initialize_fpa+0xd9>
cmpl   $0x0,0x10(%rbp)
jl     1245 <__cvmx_helper_initialize_fpa+0x115>
mov    0x10(%rbp),%edi
mov    0x18(%rbp),%esi
mov    0x20(%rbp),%edx
lea    0xe5f(%rip),%rcx
call   1040 <__cvmx_helper_initialize_fpa_pool@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1240 <__cvmx_helper_initialize_fpa+0x110>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12c4 <__cvmx_helper_initialize_fpa+0x194>
jmp    1245 <__cvmx_helper_initialize_fpa+0x115>
cmpl   $0x0,0x28(%rbp)
jl     1281 <__cvmx_helper_initialize_fpa+0x151>
mov    0x28(%rbp),%edi
mov    0x30(%rbp),%esi
mov    0x38(%rbp),%edx
lea    0xe37(%rip),%rcx
call   1040 <__cvmx_helper_initialize_fpa_pool@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     127c <__cvmx_helper_initialize_fpa+0x14c>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12c4 <__cvmx_helper_initialize_fpa+0x194>
jmp    1281 <__cvmx_helper_initialize_fpa+0x151>
cmpl   $0x0,0x40(%rbp)
jl     12bd <__cvmx_helper_initialize_fpa+0x18d>
mov    0x40(%rbp),%edi
mov    0x48(%rbp),%esi
mov    0x50(%rbp),%edx
lea    0xe0f(%rip),%rcx
call   1040 <__cvmx_helper_initialize_fpa_pool@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     12b8 <__cvmx_helper_initialize_fpa+0x188>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12c4 <__cvmx_helper_initialize_fpa+0x194>
jmp    12bd <__cvmx_helper_initialize_fpa+0x18d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__cvmx_helper_initialize_fpa>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %edx,%ebp
mov    %esi,%r13d
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <cvmx_fpa_enable@plt>
lea    -0x1(%rbp),%eax
cmp    $0x3f,%eax
ja     1168 <__cvmx_helper_initialize_fpa+0x38>
lea    0xe9f(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
test   %ebx,%ebx
js     1187 <__cvmx_helper_initialize_fpa+0x57>
lea    0xeed(%rip),%rcx
mov    %ebx,%edi
mov    %r13d,%esi
mov    %ebp,%edx
call   1040 <__cvmx_helper_initialize_fpa_pool@plt>
test   %eax,%eax
jne    120a <__cvmx_helper_initialize_fpa+0xda>
test   %r12d,%r12d
js     11a5 <__cvmx_helper_initialize_fpa+0x75>
lea    0xedc(%rip),%rcx
mov    %r12d,%edi
mov    %r15d,%esi
mov    %r14d,%edx
call   1040 <__cvmx_helper_initialize_fpa_pool@plt>
test   %eax,%eax
jne    120a <__cvmx_helper_initialize_fpa+0xda>
mov    0x40(%rsp),%edi
test   %edi,%edi
js     11c5 <__cvmx_helper_initialize_fpa+0x95>
mov    0x50(%rsp),%edx
mov    0x48(%rsp),%esi
lea    0xec6(%rip),%rcx
call   1040 <__cvmx_helper_initialize_fpa_pool@plt>
test   %eax,%eax
jne    120a <__cvmx_helper_initialize_fpa+0xda>
mov    0x58(%rsp),%edi
test   %edi,%edi
js     11e5 <__cvmx_helper_initialize_fpa+0xb5>
mov    0x68(%rsp),%edx
mov    0x60(%rsp),%esi
lea    0xeba(%rip),%rcx
call   1040 <__cvmx_helper_initialize_fpa_pool@plt>
test   %eax,%eax
jne    120a <__cvmx_helper_initialize_fpa+0xda>
mov    0x70(%rsp),%edi
test   %edi,%edi
js     1208 <__cvmx_helper_initialize_fpa+0xd8>
mov    0x80(%rsp),%edx
mov    0x78(%rsp),%esi
lea    0xeab(%rip),%rcx
call   1040 <__cvmx_helper_initialize_fpa_pool@plt>
test   %eax,%eax
jne    120a <__cvmx_helper_initialize_fpa+0xda>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [96 x i8] c"Warning: %d packet buffers may not be enough for hardware prefetch. 65 or more is recommended.\0A\00"
@.str.1 = [15 x i8] c"Packet Buffers\00"
@.str.2 = [19 x i8] c"Work Queue Entries\00"
@.str.3 = [20 x i8] c"PKO Command Buffers\00"
@.str.4 = [20 x i8] c"TIM Command Buffers\00"
@.str.5 = [20 x i8] c"DFA Command Buffers\00"
define i32 @__cvmx_helper_initialize_fpa(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14) {
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
store i32 %0, i32* %17
store i32 %1, i32* %18
store i32 %2, i32* %19
store i32 %3, i32* %20
store i32 %4, i32* %21
store i32 %5, i32* %22
store i32 %6, i32* %23
store i32 %7, i32* %24
store i32 %8, i32* %25
store i32 %9, i32* %26
store i32 %10, i32* %27
store i32 %11, i32* %28
store i32 %12, i32* %29
store i32 %13, i32* %30
store i32 %14, i32* %31
%33 = call i32 (...) @cvmx_fpa_enable()
%34 = load i32, i32* %19
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %42
36: ; preds = %15
%37 = load i32, i32* %19
%38 = icmp sle i32 %37, 64
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32, i32* %19
%41 = call i32 @printf(i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %39, %36, %15
%43 = load i32, i32* %17
%44 = icmp sge i32 %43, 0
br i1 %44, label %45, label %55
45: ; preds = %42
%46 = load i32, i32* %17
%47 = load i32, i32* %18
%48 = load i32, i32* %19
%49 = call i32 @__cvmx_helper_initialize_fpa_pool(i32 %46, i32 %47, i32 %48, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i32 %49, i32* %32
%50 = load i32, i32* %32
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %45
%53 = load i32, i32* %32
store i32 %53, i32* %16
br label %108
54: ; preds = %45
br label %55
55: ; preds = %54, %42
%56 = load i32, i32* %20
%57 = icmp sge i32 %56, 0
br i1 %57, label %58, label %68
58: ; preds = %55
%59 = load i32, i32* %20
%60 = load i32, i32* %21
%61 = load i32, i32* %22
%62 = call i32 @__cvmx_helper_initialize_fpa_pool(i32 %59, i32 %60, i32 %61, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 %62, i32* %32
%63 = load i32, i32* %32
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %58
%66 = load i32, i32* %32
store i32 %66, i32* %16
br label %108
67: ; preds = %58
br label %68
68: ; preds = %67, %55
%69 = load i32, i32* %23
%70 = icmp sge i32 %69, 0
br i1 %70, label %71, label %81
71: ; preds = %68
%72 = load i32, i32* %23
%73 = load i32, i32* %24
%74 = load i32, i32* %25
%75 = call i32 @__cvmx_helper_initialize_fpa_pool(i32 %72, i32 %73, i32 %74, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store i32 %75, i32* %32
%76 = load i32, i32* %32
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %71
%79 = load i32, i32* %32
store i32 %79, i32* %16
br label %108
80: ; preds = %71
br label %81
81: ; preds = %80, %68
%82 = load i32, i32* %26
%83 = icmp sge i32 %82, 0
br i1 %83, label %84, label %94
84: ; preds = %81
%85 = load i32, i32* %26
%86 = load i32, i32* %27
%87 = load i32, i32* %28
%88 = call i32 @__cvmx_helper_initialize_fpa_pool(i32 %85, i32 %86, i32 %87, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
store i32 %88, i32* %32
%89 = load i32, i32* %32
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %84
%92 = load i32, i32* %32
store i32 %92, i32* %16
br label %108
93: ; preds = %84
br label %94
94: ; preds = %93, %81
%95 = load i32, i32* %29
%96 = icmp sge i32 %95, 0
br i1 %96, label %97, label %107
97: ; preds = %94
%98 = load i32, i32* %29
%99 = load i32, i32* %30
%100 = load i32, i32* %31
%101 = call i32 @__cvmx_helper_initialize_fpa_pool(i32 %98, i32 %99, i32 %100, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
store i32 %101, i32* %32
%102 = load i32, i32* %32
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %106
104: ; preds = %97
%105 = load i32, i32* %32
store i32 %105, i32* %16
br label %108
106: ; preds = %97
br label %107
107: ; preds = %106, %94
store i32 0, i32* %16
br label %108
108: ; preds = %107, %104, %91, %78, %65, %52
%109 = load i32, i32* %16
ret i32 %109
}

LLVM IR (-O2):
@.str = [96 x i8] c"Warning: %d packet buffers may not be enough for hardware prefetch. 65 or more is recommended.\0A\00"
@.str.1 = [15 x i8] c"Packet Buffers\00"
@.str.2 = [19 x i8] c"Work Queue Entries\00"
@.str.3 = [20 x i8] c"PKO Command Buffers\00"
@.str.4 = [20 x i8] c"TIM Command Buffers\00"
@.str.5 = [20 x i8] c"DFA Command Buffers\00"
define i32 @__cvmx_helper_initialize_fpa(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14) {
%16 = tail call i32 (...) @cvmx_fpa_enable()
%17 = add i32 %2, -1
%18 = icmp ult i32 %17, 64
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = tail call i32 @printf(i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %21
21: ; preds = %19, %15
%22 = icmp sgt i32 %0, -1
br i1 %22, label %23, label %26
23: ; preds = %21
%24 = tail call i32 @__cvmx_helper_initialize_fpa_pool(i32 %0, i32 %1, i32 %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %47
26: ; preds = %23, %21
%27 = icmp sgt i32 %3, -1
br i1 %27, label %28, label %31
28: ; preds = %26
%29 = tail call i32 @__cvmx_helper_initialize_fpa_pool(i32 %3, i32 %4, i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %47
31: ; preds = %28, %26
%32 = icmp sgt i32 %6, -1
br i1 %32, label %33, label %36
33: ; preds = %31
%34 = tail call i32 @__cvmx_helper_initialize_fpa_pool(i32 %6, i32 %7, i32 %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %47
36: ; preds = %33, %31
%37 = icmp sgt i32 %9, -1
br i1 %37, label %38, label %41
38: ; preds = %36
%39 = tail call i32 @__cvmx_helper_initialize_fpa_pool(i32 %9, i32 %10, i32 %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %47
41: ; preds = %38, %36
%42 = icmp sgt i32 %12, -1
br i1 %42, label %43, label %46
43: ; preds = %41
%44 = tail call i32 @__cvmx_helper_initialize_fpa_pool(i32 %12, i32 %13, i32 %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %43, %41
br label %47
47: ; preds = %43, %38, %33, %28, %23, %46
%48 = phi i32 [ 0, %46 ], [ %24, %23 ], [ %29, %28 ], [ %34, %33 ], [ %39, %38 ], [ %44, %43 ]
ret i32 %48
}