#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 rand();
int MyShuffle(int x, int y) {
  int i = rand() % 10;
  int r_number = i ^ 1;
  while (r_number > y) {
    if (r_number > y || r_number < y) {
      r_number = i ^= i;
    } else {
      return r_number;
    }
  }
  return r_number;
}


x86 assembly (clang, -O0):
<MyShuffle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    117e <MyShuffle+0x6e>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     115d <MyShuffle+0x4d>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    116e <MyShuffle+0x5e>
mov    -0x10(%rbp),%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0x14(%rbp)
jmp    1179 <MyShuffle+0x69>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1184 <MyShuffle+0x74>
jmp    1139 <MyShuffle+0x29>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MyShuffle>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xor    $0x1,%eax
cmp    %ebx,%eax
cmovg  %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @MyShuffle(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = call i32 (...) @rand()
%9 = srem i32 %8, 10
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = xor i32 %10, 1
store i32 %11, i32* %7
br label %12
12: ; preds = %30, %2
%13 = load i32, i32* %7
%14 = load i32, i32* %5
%15 = icmp sgt i32 %13, %14
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = load i32, i32* %7
%18 = load i32, i32* %5
%19 = icmp sgt i32 %17, %18
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = load i32, i32* %7
%22 = load i32, i32* %5
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %28
24: ; preds = %20, %16
%25 = load i32, i32* %6
%26 = load i32, i32* %6
%27 = xor i32 %26, %25
store i32 %27, i32* %6
store i32 %27, i32* %7
br label %30
28: ; preds = %20
%29 = load i32, i32* %7
store i32 %29, i32* %3
br label %33
30: ; preds = %24
br label %12
31: ; preds = %12
%32 = load i32, i32* %7
store i32 %32, i32* %3
br label %33
33: ; preds = %31, %28
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
define i32 @MyShuffle(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 10
%5 = xor i32 %4, 1
%6 = icmp sgt i32 %5, %1
%7 = select i1 %6, i32 0, i32 %5
ret i32 %7
}