// File: /workspace/github_c_makefile_star2_O0/ranbenbasat[P]RHHH/prng.c
// Function: MedSelect
int MedSelect(int k, int n, int arr[]) {
  int a, temp;

  int i, ir, j, mid, l;

  l=1;
  ir=n;
  for (;;) {
    if (ir <= l+1) {
      if (ir == l+1 && arr[ir] < arr[l]) {
	SWAP(arr[l],arr[ir])
	  }
      return arr[k];
    }
    else
      {
	mid=(l+ir) >> 1;
	SWAP(arr[mid],arr[l+1])
	  if (arr[l] > arr[ir]) {
	    SWAP(arr[l],arr[ir])
	      }
	if (arr[l+1] > arr[ir]) {
	  SWAP(arr[l+1],arr[ir])
	    }
	if (arr[l] > arr[l+1]) {
	  SWAP(arr[l],arr[l+1])
	    }
	i=l+1;
	j=ir;
	a=arr[l+1];
	for (;;) {
	  do i++; while (arr[i] < a);
	  do j--; while (arr[j] > a);
	  if (j < i) break;
	  SWAP(arr[i],arr[j])
	    }
	arr[l+1]=arr[j];
	arr[j]=a;
	if (j >= k) ir=j-1;
	if (j <= k) l=i;
      }
  }
}

// Assembly:
movl %edi, -0x4(%rsp)
movl %esi, -0x8(%rsp)
movq %rdx, -0x10(%rsp)
movl $0x1, -0x2c(%rsp)
movl -0x8(%rsp), %eax
movl %eax, -0x20(%rsp)
movl -0x20(%rsp), %eax
movl -0x2c(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jg 0x3521
movl -0x20(%rsp), %eax
movl -0x2c(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3513
movq -0x10(%rsp), %rax
movslq -0x20(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x10(%rsp), %rcx
movslq -0x2c(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x3513
movq -0x10(%rsp), %rax
movslq -0x2c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rsp)
movq -0x10(%rsp), %rax
movslq -0x20(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rsp), %rax
movslq -0x2c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rsp), %edx
movq -0x10(%rsp), %rax
movslq -0x20(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rsp), %rax
movslq -0x4(%rsp), %rcx
movl (%rax,%rcx,4), %eax
retq
movl -0x2c(%rsp), %eax
addl -0x20(%rsp), %eax
sarl %eax
movl %eax, -0x28(%rsp)
movq -0x10(%rsp), %rax
movslq -0x28(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rsp)
movq -0x10(%rsp), %rax
movl -0x2c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rsp), %rax
movslq -0x28(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rsp), %edx
movq -0x10(%rsp), %rax
movl -0x2c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rsp), %rax
movslq -0x2c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x10(%rsp), %rcx
movslq -0x20(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jle 0x35cd
movq -0x10(%rsp), %rax
movslq -0x2c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rsp)
movq -0x10(%rsp), %rax
movslq -0x20(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rsp), %rax
movslq -0x2c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rsp), %edx
movq -0x10(%rsp), %rax
movslq -0x20(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rsp), %rax
movl -0x2c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movq -0x10(%rsp), %rcx
movslq -0x20(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jle 0x3634
movq -0x10(%rsp), %rax
movl -0x2c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rsp)
movq -0x10(%rsp), %rax
movslq -0x20(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rsp), %rax
movl -0x2c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rsp), %edx
movq -0x10(%rsp), %rax
movslq -0x20(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rsp), %rax
movslq -0x2c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x10(%rsp), %rcx
movl -0x2c(%rsp), %edx
addl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jle 0x369b
movq -0x10(%rsp), %rax
movslq -0x2c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rsp)
movq -0x10(%rsp), %rax
movl -0x2c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rsp), %rax
movslq -0x2c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rsp), %edx
movq -0x10(%rsp), %rax
movl -0x2c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
movl -0x20(%rsp), %eax
movl %eax, -0x24(%rsp)
movq -0x10(%rsp), %rax
movl -0x2c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x14(%rsp)
jmp 0x36c6
movl -0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rsp), %eax
jl 0x36c6
jmp 0x36e6
movl -0x24(%rsp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rsp)
movq -0x10(%rsp), %rax
movslq -0x24(%rsp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rsp), %eax
jg 0x36e6
movl -0x24(%rsp), %eax
cmpl -0x1c(%rsp), %eax
jge 0x3710
jmp 0x3751
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rsp)
movq -0x10(%rsp), %rax
movslq -0x24(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rsp), %edx
movq -0x10(%rsp), %rax
movslq -0x24(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x36c4
movq -0x10(%rsp), %rax
movslq -0x24(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rsp), %rax
movl -0x2c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x14(%rsp), %edx
movq -0x10(%rsp), %rax
movslq -0x24(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x24(%rsp), %eax
cmpl -0x4(%rsp), %eax
jl 0x3796
movl -0x24(%rsp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rsp)
movl -0x24(%rsp), %eax
cmpl -0x4(%rsp), %eax
jg 0x37a8
movl -0x1c(%rsp), %eax
movl %eax, -0x2c(%rsp)
jmp 0x37aa
jmp 0x349d
nop