#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 */

/* Variables and functions */
int /*<<< orphan*/ _drop_metadata(char const *, int);
int /*<<< orphan*/ init_full_scan_done(int /*<<< orphan*/);
int strcmp(char const *, char *);
int vgname_is_locked(char *);
void lvmcache_drop_metadata(char const *vgname, int drop_precommitted) {
  int tmp;
  int tmp___0;
  {
    { tmp___0 = strcmp(vgname, "#orphans"); }
    if (tmp___0) {
      { tmp = vgname_is_locked("#global"); }
      if (tmp) {
      } else {
        { _drop_metadata(vgname, drop_precommitted); }
      }
    } else {
      {
        _drop_metadata("#orphans_lvm2", 0);
        _drop_metadata("#orphans_lvm1", 0);
        _drop_metadata("#orphans_pool", 0);
        init_full_scan_done(0);
      }
    }
    return;
  }
}


x86 assembly (clang, -O0):
<lvmcache_drop_metadata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1050 <strcmp@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     119b <lvmcache_drop_metadata+0x5b>
lea    0xe96(%rip),%rdi
call   1030 <vgname_is_locked@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     118a <lvmcache_drop_metadata+0x4a>
jmp    1196 <lvmcache_drop_metadata+0x56>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <_drop_metadata@plt>
jmp    11cc <lvmcache_drop_metadata+0x8c>
lea    0xe6f(%rip),%rdi
xor    %esi,%esi
call   1040 <_drop_metadata@plt>
lea    0xe6f(%rip),%rdi
xor    %esi,%esi
call   1040 <_drop_metadata@plt>
lea    0xe6f(%rip),%rdi
xor    %esi,%esi
call   1040 <_drop_metadata@plt>
xor    %edi,%edi
call   1060 <init_full_scan_done@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lvmcache_drop_metadata>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xeb1(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     116f <lvmcache_drop_metadata+0x2f>
lea    0xeaa(%rip),%rdi
call   1030 <vgname_is_locked@plt>
test   %eax,%eax
je     11a6 <lvmcache_drop_metadata+0x66>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe9b(%rip),%rdi
xor    %esi,%esi
call   1040 <_drop_metadata@plt>
lea    0xe9b(%rip),%rdi
xor    %esi,%esi
call   1040 <_drop_metadata@plt>
lea    0xe9b(%rip),%rdi
xor    %esi,%esi
call   1040 <_drop_metadata@plt>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <init_full_scan_done@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <_drop_metadata@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"#orphans\00"
@.str.1 = [8 x i8] c"#global\00"
@.str.2 = [14 x i8] c"#orphans_lvm2\00"
@.str.3 = [14 x i8] c"#orphans_lvm1\00"
@.str.4 = [14 x i8] c"#orphans_pool\00"
define void @lvmcache_drop_metadata(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @strcmp(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %2
%12 = call i32 @vgname_is_locked(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
br label %20
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = call i32 @_drop_metadata(i8* %17, i32 %18)
br label %20
20: ; preds = %16, %15
br label %26
21: ; preds = %2
%22 = call i32 @_drop_metadata(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 0)
%23 = call i32 @_drop_metadata(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 0)
%24 = call i32 @_drop_metadata(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 0)
%25 = call i32 @init_full_scan_done(i32 0)
br label %26
26: ; preds = %21, %20
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"#orphans\00"
@.str.1 = [8 x i8] c"#global\00"
@.str.2 = [14 x i8] c"#orphans_lvm2\00"
@.str.3 = [14 x i8] c"#orphans_lvm1\00"
@.str.4 = [14 x i8] c"#orphans_pool\00"
define void @lvmcache_drop_metadata(i8* %0, i32 %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i32 @vgname_is_locked(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = tail call i32 @_drop_metadata(i8* %0, i32 %1)
br label %15
10: ; preds = %2
%11 = tail call i32 @_drop_metadata(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 0)
%12 = tail call i32 @_drop_metadata(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 0)
%13 = tail call i32 @_drop_metadata(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 0)
%14 = tail call i32 @init_full_scan_done(i32 0)
br label %15
15: ; preds = %8, %5, %10
ret void
}