// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/init.c
// Function: init_materials
void init_materials()
{
	int i, j;
	char *str;
	struct rod *rd;
	bool metused[NMETAL], woodused[NWOOD];

	for (i = 0; i < NWOOD; i++)
		woodused[i] = FALSE;
	for (i = 0; i < NMETAL; i++)
		metused[i] = FALSE;

	for (i = 0; i < MAXSTICKS; i++) {
		rd = &ws_stuff[i];
		for (;;)  {
			if (rnd(100) > 50) {
				j = rnd(NMETAL);
				if (!metused[j]) {
					str = metal[j];
					rd->ws_type = "wand";
					rd->ws_vol = V_WS_WAND;
					rd->ws_wght = W_WS_WAND;
					metused[j] = TRUE;
					break;
				}
			}
			else {
				j = rnd(NWOOD);
				if (!woodused[j]) {
					str = wood[j];
					rd->ws_type = "staff";
					rd->ws_vol = V_WS_STAFF;
					rd->ws_wght = W_WS_WAND;
					woodused[j] = TRUE;
					break;
				}
			}
		} 
		ws_stuff[i].ws_made = str;
		ws_know[i] = FALSE;
		ws_guess[i] = NULL;
		if (i > 0)
			ws_magic[i].mi_prob += ws_magic[i-1].mi_prob;
	}
	badcheck("sticks", ws_magic);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
cmpl $0x18, -0x4(%rbp)
jge 0xd4d9
movslq -0x4(%rbp), %rax
movb $0x0, -0x40(%rbp,%rax)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0xd4bf
movl $0x0, -0x4(%rbp)
cmpl $0xf, -0x4(%rbp)
jge 0xd4fa
movslq -0x4(%rbp), %rax
movb $0x0, -0x27(%rbp,%rax)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0xd4e0
movl $0x0, -0x4(%rbp)
cmpl $0x1a, -0x4(%rbp)
jge 0xd677
movslq -0x4(%rbp), %rcx
leaq 0x2c6ca(%rip), %rax     # 0x39be0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x32, %eax
jle 0xd590
movl $0xf, %edi
movb $0x0, %al
callq 0xef20
movl %eax, -0x8(%rbp)
movslq -0x8(%rbp), %rax
testb $0x1, -0x27(%rbp,%rax)
jne 0xd58e
movslq -0x8(%rbp), %rcx
leaq 0x28da9(%rip), %rax     # 0x36300
movq (%rax,%rcx,8), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
leaq 0x1d09f(%rip), %rcx     # 0x2a609
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movl $0x6e, 0x10(%rax)
movq -0x18(%rbp), %rax
movl $0x3c, 0x14(%rax)
movslq -0x8(%rbp), %rax
movb $0x1, -0x27(%rbp,%rax)
jmp 0xd5f3
jmp 0xd5ee
movl $0x18, %edi
movb $0x0, %al
callq 0xef20
movl %eax, -0x8(%rbp)
movslq -0x8(%rbp), %rax
testb $0x1, -0x40(%rbp,%rax)
jne 0xd5ec
movslq -0x8(%rbp), %rcx
leaq 0x28c8b(%rip), %rax     # 0x36240
movq (%rax,%rcx,8), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
leaq 0x1cc43(%rip), %rcx     # 0x2a20b
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movl $0xc8, 0x10(%rax)
movq -0x18(%rbp), %rax
movl $0x3c, 0x14(%rax)
movslq -0x8(%rbp), %rax
movb $0x1, -0x40(%rbp,%rax)
jmp 0xd5f3
jmp 0xd5ee
jmp 0xd521
movq -0x10(%rbp), %rcx
movslq -0x4(%rbp), %rdx
leaq 0x2c5de(%rip), %rax     # 0x39be0
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movslq -0x4(%rbp), %rcx
leaq 0x2c298(%rip), %rax     # 0x398b0
movb $0x0, (%rax,%rcx)
movslq -0x4(%rbp), %rcx
leaq 0x2c159(%rip), %rax     # 0x39780
movq $0x0, (%rax,%rcx,8)
cmpl $0x0, -0x4(%rbp)
jle 0xd667
movl -0x4(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x2817b(%rip), %rax     # 0x357c0
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movslq -0x4(%rbp), %rdx
leaq 0x28166(%rip), %rax     # 0x357c0
shlq $0x4, %rdx
addq %rdx, %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
jmp 0xd669
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0xd501
leaq 0x1d7b7(%rip), %rdi     # 0x2ae35
leaq 0x2813b(%rip), %rsi     # 0x357c0
callq 0xd000
addq $0x40, %rsp
popq %rbp
retq