#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 */
struct Var {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pA(char *, ...);
void __func_rshift_uint(struct Var *avar, const char *areg, const char *lreg,
                        const char *rreg) {
  pA("if (%s >= 32) {", rreg);
  pA("%s = 0;", areg);
  pA("} else {");
  pA("if ((%s < 0) & (%s >= 1)) {", lreg, rreg);
  pA("%s &= 0x7fffffff;", lreg);
  pA("%s >>= %s;", lreg, rreg);
  pA("%s--;", rreg);
  pA("%s = 0x40000000 >> %s;", areg, rreg);
  pA("%s |= %s;", areg, lreg);
  pA("} else {");
  pA("%s = %s >> %s;", areg, lreg, rreg);
  pA("}");
  pA("}");
}


x86 assembly (clang, -O0):
<__func_rshift_uint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x10(%rbp),%rsi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x18(%rbp),%rsi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x20(%rbp),%rsi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__func_rshift_uint>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%r15
lea    0xed8(%rip),%rdi
mov    %rcx,%rsi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xed7(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xece(%rip),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xec6(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xece(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xecf(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xec6(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xebb(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xebe(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <pA@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xeaa(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xea2(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <pA@plt>
mov    %rbx,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <pA@plt>

LLVM IR (-O0):
%struct.Var = type { i32 }
@.str = [16 x i8] c"if (%s >= 32) {\00"
@.str.1 = [8 x i8] c"%s = 0;\00"
@.str.2 = [9 x i8] c"} else {\00"
@.str.3 = [28 x i8] c"if ((%s < 0) & (%s >= 1)) {\00"
@.str.4 = [18 x i8] c"%s &= 0x7fffffff;\00"
@.str.5 = [11 x i8] c"%s >>= %s;\00"
@.str.6 = [6 x i8] c"%s--;\00"
@.str.7 = [23 x i8] c"%s = 0x40000000 >> %s;\00"
@.str.8 = [10 x i8] c"%s |= %s;\00"
@.str.9 = [15 x i8] c"%s = %s >> %s;\00"
@.str.10 = [2 x i8] c"}\00"
define void @__func_rshift_uint(%struct.Var* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca %struct.Var*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store %struct.Var* %0, %struct.Var** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %8
%10 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %6
%12 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%14 = load i8*, i8** %7
%15 = load i8*, i8** %8
%16 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %14, i8* %15)
%17 = load i8*, i8** %7
%18 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %17)
%19 = load i8*, i8** %7
%20 = load i8*, i8** %8
%21 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* %19, i8* %20)
%22 = load i8*, i8** %8
%23 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %22)
%24 = load i8*, i8** %6
%25 = load i8*, i8** %8
%26 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %24, i8* %25)
%27 = load i8*, i8** %6
%28 = load i8*, i8** %7
%29 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %27, i8* %28)
%30 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%31 = load i8*, i8** %6
%32 = load i8*, i8** %7
%33 = load i8*, i8** %8
%34 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %31, i8* %32, i8* %33)
%35 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%36 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.Var = type { i32 }
@.str = [16 x i8] c"if (%s >= 32) {\00"
@.str.1 = [8 x i8] c"%s = 0;\00"
@.str.2 = [9 x i8] c"} else {\00"
@.str.3 = [28 x i8] c"if ((%s < 0) & (%s >= 1)) {\00"
@.str.4 = [18 x i8] c"%s &= 0x7fffffff;\00"
@.str.5 = [11 x i8] c"%s >>= %s;\00"
@.str.6 = [6 x i8] c"%s--;\00"
@.str.7 = [23 x i8] c"%s = 0x40000000 >> %s;\00"
@.str.8 = [10 x i8] c"%s |= %s;\00"
@.str.9 = [15 x i8] c"%s = %s >> %s;\00"
@.str.10 = [2 x i8] c"}\00"
define void @__func_rshift_uint(%struct.Var* nocapture readnone %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%7 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %2, i8* %3)
%9 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%10 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* %2, i8* %3)
%11 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %3)
%12 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %1, i8* %3)
%13 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %1, i8* %2)
%14 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %1, i8* %2, i8* %3)
%16 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
ret void
}