#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_sint(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) {", lreg);
  pA("%s = ~%s;", lreg, lreg);
  pA("%s++;", lreg);
  pA("%s >>= %s;", lreg, rreg);
  pA("%s = ~%s;", lreg, lreg);
  pA("%s++;", lreg);
  pA("%s = %s;", areg, lreg);
  pA("} else {");
  pA("%s = %s >> %s;", areg, lreg, rreg);
  pA("}");
  pA("}");
}


x86 assembly (clang, -O0):
<__func_rshift_sint>:
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
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x18(%rbp),%rsi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x18(%rbp),%rsi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__func_rshift_sint>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
lea    0xed5(%rip),%rdi
mov    %rcx,%rsi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xed4(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xecb(%rip),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xec3(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xec0(%rip),%r13
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xeb3(%rip),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xea5(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <pA@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <pA@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xe7f(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <pA@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xe6a(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xe62(%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    %r13
pop    %r14
pop    %r15
pop    %rbp
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 = [14 x i8] c"if (%s < 0) {\00"
@.str.4 = [10 x i8] c"%s = ~%s;\00"
@.str.5 = [6 x i8] c"%s++;\00"
@.str.6 = [11 x i8] c"%s >>= %s;\00"
@.str.7 = [9 x i8] c"%s = %s;\00"
@.str.8 = [15 x i8] c"%s = %s >> %s;\00"
@.str.9 = [2 x i8] c"}\00"
define void @__func_rshift_sint(%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 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %14)
%16 = load i8*, i8** %7
%17 = load i8*, i8** %7
%18 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %16, i8* %17)
%19 = load i8*, i8** %7
%20 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %19)
%21 = load i8*, i8** %7
%22 = load i8*, i8** %8
%23 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %21, i8* %22)
%24 = load i8*, i8** %7
%25 = load i8*, i8** %7
%26 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %24, i8* %25)
%27 = load i8*, i8** %7
%28 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %27)
%29 = load i8*, i8** %6
%30 = load i8*, i8** %7
%31 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* %29, i8* %30)
%32 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%33 = load i8*, i8** %6
%34 = load i8*, i8** %7
%35 = load i8*, i8** %8
%36 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8* %33, i8* %34, i8* %35)
%37 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%38 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, 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 = [14 x i8] c"if (%s < 0) {\00"
@.str.4 = [10 x i8] c"%s = ~%s;\00"
@.str.5 = [6 x i8] c"%s++;\00"
@.str.6 = [11 x i8] c"%s >>= %s;\00"
@.str.7 = [9 x i8] c"%s = %s;\00"
@.str.8 = [15 x i8] c"%s = %s >> %s;\00"
@.str.9 = [2 x i8] c"}\00"
define void @__func_rshift_sint(%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 ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%9 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %2, i8* %2)
%10 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%11 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %2, i8* %3)
%12 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %2, i8* %2)
%13 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%14 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* %1, i8* %2)
%15 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8* %1, i8* %2, i8* %3)
%17 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
ret void
}