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

/* Variables and functions */
int /*<<< orphan*/ clear_hi(struct intel_super *);
int load_imsm_disk(int, struct intel_super *, char *, int);
int load_imsm_mpb(int, struct intel_super *, char *);
int parse_raid_devices(struct intel_super *);
int load_and_parse_mpb(int fd, struct intel_super *super, char *devname,
                       int keep_fd) {
  int err;
  err = load_imsm_mpb(fd, super, devname);
  if (err)
    return err;
  err = load_imsm_disk(fd, super, devname, keep_fd);
  if (err)
    return err;
  err = parse_raid_devices(super);
  clear_hi(super);
  return err;
}


x86 assembly (clang, -O0):
<load_and_parse_mpb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <load_imsm_mpb@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     117e <load_and_parse_mpb+0x3e>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11c4 <load_and_parse_mpb+0x84>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1050 <load_imsm_disk@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     11a9 <load_and_parse_mpb+0x69>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11c4 <load_and_parse_mpb+0x84>
mov    -0x10(%rbp),%rdi
call   1060 <parse_raid_devices@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <clear_hi@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_and_parse_mpb>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%rbp
mov    %rsi,%r15
mov    %edi,%ebx
call   1030 <load_imsm_mpb@plt>
test   %eax,%eax
jne    1183 <load_and_parse_mpb+0x43>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %rbp,%rdx
mov    %r14d,%ecx
call   1050 <load_imsm_disk@plt>
test   %eax,%eax
jne    1183 <load_and_parse_mpb+0x43>
mov    %r15,%rdi
call   1060 <parse_raid_devices@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1040 <clear_hi@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.intel_super = type { i32 }
define i32 @load_and_parse_mpb(i32 %0, %struct.intel_super* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.intel_super*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store %struct.intel_super* %1, %struct.intel_super** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%11 = load i32, i32* %6
%12 = load %struct.intel_super*, %struct.intel_super** %7
%13 = load i8*, i8** %8
%14 = call i32 @load_imsm_mpb(i32 %11, %struct.intel_super* %12, i8* %13)
store i32 %14, i32* %10
%15 = load i32, i32* %10
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %4
%18 = load i32, i32* %10
store i32 %18, i32* %5
br label %35
19: ; preds = %4
%20 = load i32, i32* %6
%21 = load %struct.intel_super*, %struct.intel_super** %7
%22 = load i8*, i8** %8
%23 = load i32, i32* %9
%24 = call i32 @load_imsm_disk(i32 %20, %struct.intel_super* %21, i8* %22, i32 %23)
store i32 %24, i32* %10
%25 = load i32, i32* %10
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %19
%28 = load i32, i32* %10
store i32 %28, i32* %5
br label %35
29: ; preds = %19
%30 = load %struct.intel_super*, %struct.intel_super** %7
%31 = call i32 @parse_raid_devices(%struct.intel_super* %30)
store i32 %31, i32* %10
%32 = load %struct.intel_super*, %struct.intel_super** %7
%33 = call i32 @clear_hi(%struct.intel_super* %32)
%34 = load i32, i32* %10
store i32 %34, i32* %5
br label %35
35: ; preds = %29, %27, %17
%36 = load i32, i32* %5
ret i32 %36
}

LLVM IR (-O2):
%struct.intel_super = type { i32 }
define i32 @load_and_parse_mpb(i32 %0, %struct.intel_super* %1, i8* %2, i32 %3) {
%5 = tail call i32 @load_imsm_mpb(i32 %0, %struct.intel_super* %1, i8* %2)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = tail call i32 @load_imsm_disk(i32 %0, %struct.intel_super* %1, i8* %2, i32 %3)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = tail call i32 @parse_raid_devices(%struct.intel_super* %1)
%12 = tail call i32 @clear_hi(%struct.intel_super* %1)
br label %13
13: ; preds = %7, %4, %10
%14 = phi i32 [ %11, %10 ], [ %5, %4 ], [ %8, %7 ]
ret i32 %14
}