#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 /*<<< orphan*/ assert(int);
unsigned int xrc4_coprime(unsigned char in, unsigned int last_used) {
  unsigned int coprime;
  coprime = (((in & 1) ? in : in + 57) ^ 96) & 255;
  assert((coprime & 1) == 1);
  if (coprime == last_used) {
    coprime = (coprime + 2) & 255;
  }
  return coprime;
}


x86 assembly (clang, -O0):
<xrc4_coprime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     113d <xrc4_coprime+0x2d>
movzbl -0x1(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1147 <xrc4_coprime+0x37>
movzbl -0x1(%rbp),%eax
add    $0x39,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    $0x60,%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1185 <xrc4_coprime+0x75>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrc4_coprime>:
push   %rbp
push   %rbx
push   %rax
lea    0x39(%rdi),%eax
test   $0x1,%dil
cmove  %eax,%edi
mov    %esi,%ebp
movzbl %dil,%ebx
xor    $0x60,%ebx
and    $0x1,%edi
call   1030 <assert@plt>
lea    0x2(%rbx),%eax
cmp    %ebp,%ebx
movzbl %al,%eax
cmovne %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @xrc4_coprime(i8 zeroext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = and i32 %7, 1
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
br label %17
13: ; preds = %2
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = add nsw i32 %15, 57
br label %17
17: ; preds = %13, %10
%18 = phi i32 [ %12, %10 ], [ %16, %13 ]
%19 = xor i32 %18, 96
%20 = and i32 %19, 255
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = and i32 %21, 1
%23 = icmp eq i32 %22, 1
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = load i32, i32* %5
%27 = load i32, i32* %4
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %33
29: ; preds = %17
%30 = load i32, i32* %5
%31 = add i32 %30, 2
%32 = and i32 %31, 255
store i32 %32, i32* %5
br label %33
33: ; preds = %29, %17
%34 = load i32, i32* %5
ret i32 %34
}

LLVM IR (-O2):
define i32 @xrc4_coprime(i8 zeroext %0, i32 %1) {
%3 = zext i8 %0 to i32
%4 = and i32 %3, 1
%5 = icmp eq i32 %4, 0
%6 = add nuw nsw i32 %3, 57
%7 = select i1 %5, i32 %6, i32 %3
%8 = and i32 %7, 255
%9 = xor i32 %8, 96
%10 = and i32 %7, 1
%11 = tail call i32 @assert(i32 %10)
%12 = icmp eq i32 %9, %1
%13 = add nuw nsw i32 %9, 2
%14 = and i32 %13, 255
%15 = select i1 %12, i32 %14, i32 %9
ret i32 %15
}