#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 vmodule {
  int dummy;
};

/* Variables and functions */
int init_rsh(struct vmodule *, char *);
int av_init_module_rsh(struct vmodule *module) {
  int res;
  res = init_rsh(module, "rsh");
  if (res < 0)
    return res;
  res = init_rsh(module, "ssh");
  if (res < 0)
    return res;
  return 0;
}


x86 assembly (clang, -O0):
<av_init_module_rsh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <init_rsh@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1144 <av_init_module_rsh+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1173 <av_init_module_rsh+0x63>
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <init_rsh@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    116c <av_init_module_rsh+0x5c>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1173 <av_init_module_rsh+0x63>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_init_module_rsh>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <init_rsh@plt>
test   %eax,%eax
js     113a <av_init_module_rsh+0x2a>
lea    0xed9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <init_rsh@plt>
mov    %eax,%ecx
sar    $0x1f,%eax
and    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vmodule = type { i32 }
@.str = [4 x i8] c"rsh\00"
@.str.1 = [4 x i8] c"ssh\00"
define i32 @av_init_module_rsh(%struct.vmodule* %0) {
%2 = alloca i32
%3 = alloca %struct.vmodule*
%4 = alloca i32
store %struct.vmodule* %0, %struct.vmodule** %3
%5 = load %struct.vmodule*, %struct.vmodule** %3
%6 = call i32 @init_rsh(%struct.vmodule* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %4
store i32 %10, i32* %2
br label %19
11: ; preds = %1
%12 = load %struct.vmodule*, %struct.vmodule** %3
%13 = call i32 @init_rsh(%struct.vmodule* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = load i32, i32* %4
store i32 %17, i32* %2
br label %19
18: ; preds = %11
store i32 0, i32* %2
br label %19
19: ; preds = %18, %16, %9
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
%struct.vmodule = type { i32 }
@.str = [4 x i8] c"rsh\00"
@.str.1 = [4 x i8] c"ssh\00"
define i32 @av_init_module_rsh(%struct.vmodule* %0) {
%2 = tail call i32 @init_rsh(%struct.vmodule* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp slt i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @init_rsh(%struct.vmodule* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp slt i32 %5, 0
%7 = select i1 %6, i32 %5, i32 0
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ %2, %1 ], [ %7, %4 ]
ret i32 %9
}