#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 floppy_init(struct vmodule *, char *, char *);
int av_init_module_floppy(struct vmodule *module) {
  int res;
  res = floppy_init(module, "floppy", ((void *)0));
  if (res < 0)
    return res;
  res = floppy_init(module, "a", "a");
  if (res < 0)
    return res;
  return 0;
}


x86 assembly (clang, -O0):
<av_init_module_floppy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <floppy_init@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1148 <av_init_module_floppy+0x38>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117a <av_init_module_floppy+0x6a>
mov    -0x10(%rbp),%rdi
lea    0xeb4(%rip),%rdx
mov    %rdx,%rsi
call   1030 <floppy_init@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1173 <av_init_module_floppy+0x63>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117a <av_init_module_floppy+0x6a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_init_module_floppy>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
xor    %edx,%edx
call   1030 <floppy_init@plt>
test   %eax,%eax
js     113f <av_init_module_floppy+0x2f>
lea    0xeda(%rip),%rdx
mov    %rbx,%rdi
mov    %rdx,%rsi
call   1030 <floppy_init@plt>
mov    %eax,%ecx
sar    $0x1f,%eax
and    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vmodule = type { i32 }
@.str = [7 x i8] c"floppy\00"
@.str.1 = [2 x i8] c"a\00"
define i32 @av_init_module_floppy(%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 @floppy_init(%struct.vmodule* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* null)
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 @floppy_init(%struct.vmodule* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 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 = [7 x i8] c"floppy\00"
@.str.1 = [2 x i8] c"a\00"
define i32 @av_init_module_floppy(%struct.vmodule* %0) {
%2 = tail call i32 @floppy_init(%struct.vmodule* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* null)
%3 = icmp slt i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @floppy_init(%struct.vmodule* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 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
}