// File: /workspace/github_c_makefile_star2_O0/j4r0g[P]Projet_Labyrinthe/fonctions/deplacement.c
// Function: prochain_deplacement
int prochain_deplacement (int pos_x, int pos_y, t_lab lab[X][Y], int bouffe, int dureevie, t_fourmi fourmi[]) {
	printf("prochian_deplacement\n");
	int ins_adj = insecte_adjacent(pos_x, pos_y, lab, bouffe, dureevie, fourmi);
	int depl=0;
	time_t t;
	srand((unsigned) time(&t));
	int random = rand()%100;
	if (lab[pos_x-1][pos_y].etat != mur || lab[pos_x][pos_y-1].etat != mur || lab[pos_x][pos_y+1].etat != mur || (lab[pos_x+1][pos_y].etat != mur && ins_adj==0)) {
		while(depl==0) {
			if (random >= 0 && random < 25 && lab[pos_x-1][pos_y].etat!=mur && lab[pos_x-1][pos_y].etat!=insecte) {
				modif_pos(lab, fourmi, pos_x, pos_y, pos_x-1, pos_y, bouffe, dureevie);
				depl=1;
			}
			else if (random >= 25 && random < 50 && lab[pos_x][pos_y-1].etat!=mur && lab[pos_x][pos_y-1].etat!=insecte) {
				modif_pos(lab, fourmi, pos_x, pos_y, pos_x, pos_y-1, bouffe, dureevie);
				depl=1;
			}
			else if (random >= 50 && random < 75 && lab[pos_x][pos_y+1].etat!=mur && lab[pos_x][pos_y+1].etat!=insecte) {
				modif_pos(lab, fourmi, pos_x, pos_y, pos_x, pos_y+1, bouffe, dureevie);
				depl=1;
			}
			else if (random >= 75 && random < 100 && lab[pos_x+1][pos_y].etat!=mur && lab[pos_x+1][pos_y].etat!=insecte) {
				modif_pos(lab, fourmi, pos_x, pos_y, pos_x+1, pos_y, bouffe, dureevie);
				depl=1;
			}
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movq %r9, -0x20(%rbp)
leaq 0x610b(%rip), %rdi      # 0x972f
movb $0x0, %al
callq 0x1080
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
movl -0x14(%rbp), %ecx
movl -0x18(%rbp), %r8d
movq -0x20(%rbp), %r9
callq 0x3460
movl %eax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x10e0
movl %eax, %edi
callq 0x10a0
callq 0x1150
movl $0x64, %ecx
cltd
idivl %ecx
movl %edx, -0x34(%rbp)
movq -0x10(%rbp), %rax
movl -0x4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x2d0, %rcx, %rcx      # imm = 0x2D0
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x23, 0x4(%rax)
jne 0x3721
movq -0x10(%rbp), %rax
movslq -0x4(%rbp), %rcx
imulq $0x2d0, %rcx, %rcx      # imm = 0x2D0
addq %rcx, %rax
movl -0x8(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x23, 0x4(%rax)
jne 0x3721
movq -0x10(%rbp), %rax
movslq -0x4(%rbp), %rcx
imulq $0x2d0, %rcx, %rcx      # imm = 0x2D0
addq %rcx, %rax
movl -0x8(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x23, 0x4(%rax)
jne 0x3721
movq -0x10(%rbp), %rax
movl -0x4(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x2d0, %rcx, %rcx      # imm = 0x2D0
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x23, 0x4(%rax)
je 0x39ad
cmpl $0x0, -0x24(%rbp)
jne 0x39ad
jmp 0x3723
cmpl $0x0, -0x28(%rbp)
jne 0x39ab
cmpl $0x0, -0x34(%rbp)
jl 0x37cb
cmpl $0x19, -0x34(%rbp)
jge 0x37cb
movq -0x10(%rbp), %rax
movl -0x4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x2d0, %rcx, %rcx      # imm = 0x2D0
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x23, 0x4(%rax)
je 0x37cb
movq -0x10(%rbp), %rax
movl -0x4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x2d0, %rcx, %rcx      # imm = 0x2D0
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x25, 0x4(%rax)
je 0x37cb
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
movl -0x4(%rbp), %r8d
subl $0x1, %r8d
movl -0x8(%rbp), %r9d
movl -0x14(%rbp), %r10d
movl -0x18(%rbp), %eax
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x4d40
movl $0x1, -0x28(%rbp)
jmp 0x39a6
cmpl $0x19, -0x34(%rbp)
jl 0x3869
cmpl $0x32, -0x34(%rbp)
jge 0x3869
movq -0x10(%rbp), %rax
movslq -0x4(%rbp), %rcx
imulq $0x2d0, %rcx, %rcx      # imm = 0x2D0
addq %rcx, %rax
movl -0x8(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x23, 0x4(%rax)
je 0x3869
movq -0x10(%rbp), %rax
movslq -0x4(%rbp), %rcx
imulq $0x2d0, %rcx, %rcx      # imm = 0x2D0
addq %rcx, %rax
movl -0x8(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x25, 0x4(%rax)
je 0x3869
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
movl -0x4(%rbp), %r8d
movl -0x8(%rbp), %r9d
subl $0x1, %r9d
movl -0x14(%rbp), %r10d
movl -0x18(%rbp), %eax
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x4d40
movl $0x1, -0x28(%rbp)
jmp 0x39a4
cmpl $0x32, -0x34(%rbp)
jl 0x3907
cmpl $0x4b, -0x34(%rbp)
jge 0x3907
movq -0x10(%rbp), %rax
movslq -0x4(%rbp), %rcx
imulq $0x2d0, %rcx, %rcx      # imm = 0x2D0
addq %rcx, %rax
movl -0x8(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x23, 0x4(%rax)
je 0x3907
movq -0x10(%rbp), %rax
movslq -0x4(%rbp), %rcx
imulq $0x2d0, %rcx, %rcx      # imm = 0x2D0
addq %rcx, %rax
movl -0x8(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x25, 0x4(%rax)
je 0x3907
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
movl -0x4(%rbp), %r8d
movl -0x8(%rbp), %r9d
addl $0x1, %r9d
movl -0x14(%rbp), %r10d
movl -0x18(%rbp), %eax
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x4d40
movl $0x1, -0x28(%rbp)
jmp 0x39a2
cmpl $0x4b, -0x34(%rbp)
jl 0x39a0
cmpl $0x64, -0x34(%rbp)
jge 0x39a0
movq -0x10(%rbp), %rax
movl -0x4(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x2d0, %rcx, %rcx      # imm = 0x2D0
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x23, 0x4(%rax)
je 0x39a0
movq -0x10(%rbp), %rax
movl -0x4(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x2d0, %rcx, %rcx      # imm = 0x2D0
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x25, 0x4(%rax)
je 0x39a0
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
movl -0x4(%rbp), %r8d
addl $0x1, %r8d
movl -0x8(%rbp), %r9d
movl -0x14(%rbp), %r10d
movl -0x18(%rbp), %eax
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x4d40
movl $0x1, -0x28(%rbp)
jmp 0x39a2
jmp 0x39a4
jmp 0x39a6
jmp 0x3723
jmp 0x39ad
xorl %eax, %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)