#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 pow(int, int);
int rand();
void init_IDX17(int *IDX, int reserved) {
  for (int i = 0; i < pow(2, 17); i++) {
    IDX[i] = reserved + (rand() % (128 - reserved));
  }
}


x86 assembly (clang, -O0):
<init_IDX17>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x2,%edi
mov    $0x11,%esi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jge    1190 <init_IDX17+0x70>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x80,%ecx
sub    -0xc(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0x18(%rbp),%edx
add    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <init_IDX17+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_IDX17>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
mov    $0x2,%edi
mov    $0x11,%esi
call   1030 <pow@plt>
test   %eax,%eax
jle    117b <init_IDX17+0x5b>
mov    $0x80,%ebp
sub    %r15d,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <rand@plt>
cltd
idiv   %ebp
add    %r15d,%edx
mov    %edx,(%r14,%rbx,4)
add    $0x1,%rbx
mov    $0x2,%edi
mov    $0x11,%esi
call   1030 <pow@plt>
cltq
cmp    %rax,%rbx
jl     1150 <init_IDX17+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @init_IDX17(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %21, %2
%7 = load i32, i32* %5
%8 = call i32 @pow(i32 2, i32 17)
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %24
10: ; preds = %6
%11 = load i32, i32* %4
%12 = call i32 (...) @rand()
%13 = load i32, i32* %4
%14 = sub nsw i32 128, %13
%15 = srem i32 %12, %14
%16 = add nsw i32 %11, %15
%17 = load i32*, i32** %3
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
store i32 %16, i32* %20
br label %21
21: ; preds = %10
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %6
24: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @init_IDX17(i32* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @pow(i32 2, i32 17)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = sub nsw i32 128, %1
br label %8
7: ; preds = %8, %2
ret void
8: ; preds = %5, %8
%9 = phi i64 [ 0, %5 ], [ %14, %8 ]
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, %6
%12 = add nsw i32 %11, %1
%13 = getelementptr inbounds i32, i32* %0, i64 %9
store i32 %12, i32* %13
%14 = add nuw nsw i64 %9, 1
%15 = tail call i32 @pow(i32 2, i32 17)
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %8, label %7
}