// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/new_leve.c
// Function: new_level
void new_level(int ltype)
{
	char ch;
	struct coord traploc;
	struct room *rp;

	if (level > max_level)
		max_level = level;

	wclear(cw);
	wclear(mw);
	clear();

	isfight = FALSE;
	levtype = ltype;

	free_list(mlist);			/* free monster list */

	if (levtype == POSTLEV)
		do_post();
	else {
		lev_mon();			/* fill in monster list */

		if (levtype == MAZELEV)
			do_maze();
		else {				/* normal levels */
			do_rooms();		/* Draw rooms */
			do_passages();		/* Draw passages */
		}
		no_food++;
		put_things();			/* Place objects (if any) */
	}
	/*
	 * Place the staircase down.
	 */
	stairs = *rnd_pos(&rooms[rnd_room()]);
	mvaddch(stairs.y, stairs.x, STAIRS);
	ntraps = 0;

	if (levtype == NORMLEV)
	{
		struct trap *trp, *maxtrp;

		/* Place the traps for normal levels only */

		if (rnd(10) < level)
		{
			ntraps = rnd(level / 4) + 1;

			if (ntraps > MAXTRAPS)
				ntraps = MAXTRAPS;

			maxtrp = &traps[ntraps];
			for (trp = &traps[0]; trp < maxtrp; trp++)
			{
again:
				switch(rnd(TYPETRAPS + 1))
				{
					case 0:
						if (rnd(100) > 25)
							goto again;
						else
							ch = POST;

					when 1: ch = TRAPDOOR;
					when 2: ch = BEARTRAP;
					when 3: ch = SLEEPTRAP;
					when 4: ch = ARROWTRAP;
					when 5: ch = TELTRAP;
					when 6: ch = DARTTRAP;
					when 7: ch = MAZETRAP;
					when 8:
					case 9:
						if (rnd(100) > 80)
							goto again;
						else
							ch = POOL;
				}
				trp->tr_flags = 0;
				traploc = *rnd_pos(&rooms[rnd_room()]);
				mvaddch(traploc.y,traploc.x,ch);
				trp->tr_type = ch;
				trp->tr_pos = traploc;

				if (ch == POOL || ch == POST)
					trp->tr_flags |= ISFOUND;

				if (ch==TELTRAP && rnd(100)<20 && trp<maxtrp-1)
				{
					struct coord newloc;

					newloc = *rnd_pos(&rooms[rnd_room()]);
					trp->tr_goto = newloc;
					trp++;
					trp->tr_goto = traploc;
					trp->tr_type = TELTRAP;
					trp->tr_pos = newloc;
					mvaddch(newloc.y, newloc.x, TELTRAP);
				}
				else
					trp->tr_goto = rndspot;
			}
		}
	}
	do
	{
		rp = &rooms[rnd_room()];
		hero = *rnd_pos(rp);
	} while(levtype==MAZELEV&&DISTANCE(hero.y,hero.x,stairs.y,stairs.x)<10);

	player.t_room = rp;
	player.t_oldch = mvinch(hero.y, hero.x);
	light(&hero);
	mvwaddch(cw,hero.y,hero.x,PLAYER);
	nochange = FALSE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
leaq 0x2027e(%rip), %rax     # 0x332f0
movl (%rax), %eax
leaq 0x20281(%rip), %rcx     # 0x332fc
cmpl (%rcx), %eax
jle 0x13091
leaq 0x2026a(%rip), %rax     # 0x332f0
movl (%rax), %ecx
leaq 0x2026d(%rip), %rax     # 0x332fc
movl %ecx, (%rax)
leaq 0x26db8(%rip), %rax     # 0x39e50
movq (%rax), %rdi
callq 0x6110
leaq 0x26db9(%rip), %rax     # 0x39e60
movq (%rax), %rdi
callq 0x6110
movq 0x1ff0a(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
callq 0x6110
leaq 0x23c43(%rip), %rax     # 0x36d08
movb $0x0, (%rax)
movl -0x4(%rbp), %ecx
leaq 0x23c02(%rip), %rax     # 0x36cd4
movl %ecx, (%rax)
leaq 0x23bd5(%rip), %rdi     # 0x36cb0
callq 0xe450
leaq 0x23bed(%rip), %rax     # 0x36cd4
cmpl $0x1, (%rax)
jne 0x130f5
movb $0x0, %al
callq 0x24570
jmp 0x13139
movb $0x0, %al
callq 0x10480
leaq 0x23bd1(%rip), %rax     # 0x36cd4
cmpl $0x2, (%rax)
jne 0x13111
movb $0x0, %al
callq 0x24ef0
jmp 0x1311f
movb $0x0, %al
callq 0x19460
movb $0x0, %al
callq 0x151f0
leaq 0x23bca(%rip), %rax     # 0x36cf0
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x23bbe(%rip), %rax     # 0x36cf0
movl %ecx, (%rax)
callq 0x13630
callq 0x135d0
cltq
leaq 0x23bd9(%rip), %rdi     # 0x36d20
imulq $0x68, %rax, %rax
addq %rax, %rdi
callq 0x19c00
movq %rax, %rcx
leaq 0x2677f(%rip), %rax     # 0x398dc
movq (%rcx), %rcx
movq %rcx, (%rax)
movq 0x1fe56(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
leaq 0x26768(%rip), %rax     # 0x398dc
movl 0x4(%rax), %esi
leaq 0x2675e(%rip), %rax     # 0x398dc
movl (%rax), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x1318c
jmp 0x131a0
movq 0x1fe2d(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
movl $0x25, %esi
callq 0x64c0
leaq 0x24131(%rip), %rax     # 0x372d8
movl $0x0, (%rax)
leaq 0x23b20(%rip), %rax     # 0x36cd4
cmpl $0x0, (%rax)
jne 0x13453
movl $0xa, %edi
movb $0x0, %al
callq 0xef20
leaq 0x20120(%rip), %rcx     # 0x332f0
cmpl (%rcx), %eax
jge 0x13451
leaq 0x20111(%rip), %rax     # 0x332f0
movl (%rax), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, %edi
movb $0x0, %al
callq 0xef20
movl %eax, %ecx
addl $0x1, %ecx
leaq 0x240da(%rip), %rax     # 0x372d8
movl %ecx, (%rax)
leaq 0x240d1(%rip), %rax     # 0x372d8
cmpl $0xa, (%rax)
jle 0x13219
leaq 0x240c5(%rip), %rax     # 0x372d8
movl $0xa, (%rax)
leaq 0x240b8(%rip), %rax     # 0x372d8
movslq (%rax), %rcx
leaq 0x23fb6(%rip), %rax     # 0x371e0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
leaq 0x23fa4(%rip), %rax     # 0x371e0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x1344f
jmp 0x13250
xorl %eax, %eax
movl $0xa, %edi
callq 0xef20
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0x9, %eax
ja 0x132da
movq -0x38(%rbp), %rax
leaq 0x1874e(%rip), %rcx     # 0x2b9c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x19, %eax
jle 0x1328e
jmp 0x13250
movb $0x5e, -0x5(%rbp)
jmp 0x132da
movb $0x3e, -0x5(%rbp)
jmp 0x132da
movb $0x7d, -0x5(%rbp)
jmp 0x132da
movb $0x24, -0x5(%rbp)
jmp 0x132da
movb $0x7b, -0x5(%rbp)
jmp 0x132da
movb $0x7e, -0x5(%rbp)
jmp 0x132da
movb $0x60, -0x5(%rbp)
jmp 0x132da
movb $0x5c, -0x5(%rbp)
jmp 0x132da
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x50, %eax
jle 0x132d4
jmp 0x13250
movb $0x22, -0x5(%rbp)
jmp 0x132da
movq -0x20(%rbp), %rax
movl $0x0, 0x10(%rax)
callq 0x135d0
cltq
leaq 0x23a2d(%rip), %rdi     # 0x36d20
imulq $0x68, %rax, %rax
addq %rax, %rdi
callq 0x19c00
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq 0x1fcb3(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x13322
jmp 0x13335
movq 0x1fc97(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
movsbl -0x5(%rbp), %esi
callq 0x64c0
movb -0x5(%rbp), %cl
movq -0x20(%rbp), %rax
movb %cl, 0x14(%rax)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, (%rax)
movsbl -0x5(%rbp), %eax
cmpl $0x22, %eax
je 0x1335c
movsbl -0x5(%rbp), %eax
cmpl $0x5e, %eax
jne 0x13369
movq -0x20(%rbp), %rax
movl 0x10(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0x10(%rax)
movsbl -0x5(%rbp), %eax
cmpl $0x7e, %eax
jne 0x1342a
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x14, %eax
jge 0x1342a
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $-0x18, %rcx
cmpq %rcx, %rax
jae 0x1342a
callq 0x135d0
cltq
leaq 0x23972(%rip), %rdi     # 0x36d20
imulq $0x68, %rax, %rax
addq %rax, %rdi
callq 0x19c00
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movb $0x7e, 0x14(%rax)
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
movq 0x1fbc1(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x13414
jmp 0x13428
movq 0x1fba5(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
movl $0x7e, %esi
callq 0x64c0
jmp 0x1343c
movq -0x20(%rbp), %rax
leaq 0x1ff7b(%rip), %rcx     # 0x333b0
movq (%rcx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x1343e
movq -0x20(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x20(%rbp)
jmp 0x13240
jmp 0x13451
jmp 0x13453
jmp 0x13455
callq 0x135d0
movslq %eax, %rcx
leaq 0x238bc(%rip), %rax     # 0x36d20
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x19c00
movq %rax, %rcx
leaq 0x23c4e(%rip), %rax     # 0x370d0
movq (%rcx), %rcx
movq %rcx, 0x50(%rax)
xorl %eax, %eax
leaq 0x23842(%rip), %rcx     # 0x36cd4
cmpl $0x2, (%rcx)
movb %al, -0x39(%rbp)
jne 0x134f9
leaq 0x2643b(%rip), %rax     # 0x398dc
movl (%rax), %eax
leaq 0x23c26(%rip), %rcx     # 0x370d0
subl 0x50(%rcx), %eax
leaq 0x26428(%rip), %rcx     # 0x398dc
movl (%rcx), %ecx
leaq 0x23c13(%rip), %rdx     # 0x370d0
subl 0x50(%rdx), %ecx
imull %ecx, %eax
leaq 0x26412(%rip), %rcx     # 0x398dc
movl 0x4(%rcx), %ecx
leaq 0x23bfc(%rip), %rdx     # 0x370d0
subl 0x54(%rdx), %ecx
leaq 0x263fe(%rip), %rdx     # 0x398dc
movl 0x4(%rdx), %edx
leaq 0x23be8(%rip), %rsi     # 0x370d0
subl 0x54(%rsi), %edx
imull %edx, %ecx
addl %ecx, %eax
cmpl $0xa, %eax
setl %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x13455
movq -0x18(%rbp), %rcx
leaq 0x23bc1(%rip), %rax     # 0x370d0
movq %rcx, 0x70(%rax)
movq 0x1faa6(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
leaq 0x23bac(%rip), %rax     # 0x370d0
movl 0x54(%rax), %esi
leaq 0x23ba2(%rip), %rax     # 0x370d0
movl 0x50(%rax), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x13545
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x40(%rbp)
jmp 0x13557
movq 0x1fa74(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
callq 0x6340
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movb %al, %cl
leaq 0x23b6d(%rip), %rax     # 0x370d0
movb %cl, 0x8f(%rax)
leaq 0x23b60(%rip), %rdi     # 0x370d0
addq $0x50, %rdi
callq 0x123b0
leaq 0x268d0(%rip), %rax     # 0x39e50
movq (%rax), %rdi
leaq 0x23b46(%rip), %rax     # 0x370d0
movl 0x54(%rax), %esi
leaq 0x23b3c(%rip), %rax     # 0x370d0
movl 0x50(%rax), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x135a3
jmp 0x135b7
leaq 0x268a6(%rip), %rax     # 0x39e50
movq (%rax), %rdi
movl $0x40, %esi
callq 0x64c0
leaq 0x23755(%rip), %rax     # 0x36d13
movb $0x0, (%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)