#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ pfprintf(int /*<<< orphan*/ *, int, char *, int, int, int,
                            int);
void print_mprf_banksel_gen(FILE *infile, unsigned int num_ni,
                            unsigned int num_no) {
  int i, j;
  if (num_no != 1) {
    for (i = 0; i < num_ni; i++) {
      pfprintf(infile, 2,
               "banksel_v(log2c(NWP)*(%d+1)-1 downto log2c(NWP)*%d) <= "
               "raddr_v(AW*(%d+1)-1 downto AW*(%d+1)-log2c(NWP));\n",
               i, i, i, i);
    }
    fprintf(infile, "\n");
  }
}


x86 assembly (clang, -O0):
<print_mprf_banksel_gen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
je     1193 <print_mprf_banksel_gen+0x73>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1183 <print_mprf_banksel_gen+0x63>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x14(%rbp),%eax
mov    $0x2,%esi
lea    0xe93(%rip),%rdx
mov    %eax,(%rsp)
call   1040 <pfprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1143 <print_mprf_banksel_gen+0x23>
mov    -0x8(%rbp),%rdi
lea    0xeda(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_mprf_banksel_gen>:
cmp    $0x1,%edx
jne    1126 <print_mprf_banksel_gen+0x6>
ret
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%r14
test   %esi,%esi
je     1162 <print_mprf_banksel_gen+0x42>
xor    %ebx,%ebx
lea    0xec1(%rip),%r15
nop
mov    %ebx,(%rsp)
mov    %r14,%rdi
mov    $0x2,%esi
mov    %r15,%rdx
mov    %ebx,%ecx
mov    %ebx,%r8d
mov    %ebx,%r9d
call   1040 <pfprintf@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1140 <print_mprf_banksel_gen+0x20>
mov    $0xa,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [106 x i8] c"banksel_v(log2c(NWP)*(%d+1)-1 downto log2c(NWP)*%d) <= raddr_v(AW*(%d+1)-1 downto AW*(%d+1)-log2c(NWP));\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_mprf_banksel_gen(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 1
br i1 %10, label %11, label %29
11: ; preds = %3
store i32 0, i32* %7
br label %12
12: ; preds = %23, %11
%13 = load i32, i32* %7
%14 = load i32, i32* %5
%15 = icmp ult i32 %13, %14
br i1 %15, label %16, label %26
16: ; preds = %12
%17 = load i32*, i32** %4
%18 = load i32, i32* %7
%19 = load i32, i32* %7
%20 = load i32, i32* %7
%21 = load i32, i32* %7
%22 = call i32 @pfprintf(i32* %17, i32 2, i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %19, i32 %20, i32 %21)
br label %23
23: ; preds = %16
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %12
26: ; preds = %12
%27 = load i32*, i32** %4
%28 = call i32 @fprintf(i32* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %26, %3
ret void
}

LLVM IR (-O2):
@.str = [106 x i8] c"banksel_v(log2c(NWP)*(%d+1)-1 downto log2c(NWP)*%d) <= raddr_v(AW*(%d+1)-1 downto AW*(%d+1)-log2c(NWP));\0A\00"
define void @print_mprf_banksel_gen(i32* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 1
br i1 %4, label %14, label %5
5: ; preds = %3
%6 = icmp eq i32 %1, 0
br i1 %6, label %12, label %7
7: ; preds = %5, %7
%8 = phi i32 [ %10, %7 ], [ 0, %5 ]
%9 = tail call i32 @pfprintf(i32* %0, i32 2, i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %8, i32 %8, i32 %8)
%10 = add nuw i32 %8, 1
%11 = icmp eq i32 %10, %1
br i1 %11, label %12, label %7
12: ; preds = %7, %5
%13 = tail call i32 @fputc(i32 10, i32* %0)
br label %14
14: ; preds = %12, %3
ret void
}