int minipmi_version2_recv_parse_match(struct minipmi_context *ctx,
                                      const char *cmd, _Bool checkrc) {
  int err, x;
  const char *v;
  err = minipmi_version2_recv(ctx);
  if (__builtin_expect(!!(err), 0))
    return err;
  err = minipmi_version2_parse(ctx);
  if (__builtin_expect(!!(err), 0))
    return err;
  v = minipmi_find_value_by_key(ctx, "cmd");
  if (__builtin_expect(!!(!v), 0))
    return -1;
  if (strcmp(v, cmd))
    return -2;
  if (checkrc) {
    err = minipmi_find_integer_value_by_key(ctx, "rc", &x);
    if (__builtin_expect(!!(err), 0))
      return err;
    if (__builtin_expect(!!(0 != x), 0))
      return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<minipmi_version2_recv_parse_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
and    $0x1,%al
mov    %al,-0x19(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <minipmi_version2_recv@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cltq
cmp    $0x0,%rax
je     119c <minipmi_version2_recv_parse_match+0x4c>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12b5 <minipmi_version2_recv_parse_match+0x165>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1070 <minipmi_version2_parse@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cltq
cmp    $0x0,%rax
je     11d1 <minipmi_version2_recv_parse_match+0x81>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12b5 <minipmi_version2_recv_parse_match+0x165>
mov    -0x10(%rbp),%rdi
lea    0xe24(%rip),%rsi
mov    $0x0,%al
call   1060 <minipmi_find_value_by_key@plt>
cltq
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
setne  %al
xor    $0xff,%al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cltq
cmp    $0x0,%rax
je     1214 <minipmi_version2_recv_parse_match+0xc4>
movl   $0xffffffff,-0x4(%rbp)
jmp    12b5 <minipmi_version2_recv_parse_match+0x165>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     1236 <minipmi_version2_recv_parse_match+0xe6>
movl   $0xfffffffe,-0x4(%rbp)
jmp    12b5 <minipmi_version2_recv_parse_match+0x165>
testb  $0x1,-0x19(%rbp)
je     12ae <minipmi_version2_recv_parse_match+0x15e>
mov    -0x10(%rbp),%rdi
lea    0xdb9(%rip),%rsi
lea    -0x24(%rbp),%rdx
mov    $0x0,%al
call   1050 <minipmi_find_integer_value_by_key@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cltq
cmp    $0x0,%rax
je     1280 <minipmi_version2_recv_parse_match+0x130>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12b5 <minipmi_version2_recv_parse_match+0x165>
xor    %eax,%eax
cmp    -0x24(%rbp),%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cltq
cmp    $0x0,%rax
je     12a9 <minipmi_version2_recv_parse_match+0x159>
movl   $0xffffffff,-0x4(%rbp)
jmp    12b5 <minipmi_version2_recv_parse_match+0x165>
jmp    12ae <minipmi_version2_recv_parse_match+0x15e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minipmi_version2_recv_parse_match>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <minipmi_version2_recv@plt>
test   %eax,%eax
jne    11d9 <minipmi_version2_recv_parse_match+0x89>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <minipmi_version2_parse@plt>
test   %eax,%eax
jne    11d9 <minipmi_version2_recv_parse_match+0x89>
lea    0xe7f(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <minipmi_find_value_by_key@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
test   %ecx,%ecx
je     11d9 <minipmi_version2_recv_parse_match+0x89>
movslq %ecx,%rdi
mov    %rbp,%rsi
call   1040 <strcmp@plt>
mov    %eax,%ecx
mov    $0xfffffffe,%eax
test   %ecx,%ecx
jne    11d9 <minipmi_version2_recv_parse_match+0x89>
test   %r14b,%r14b
je     11d7 <minipmi_version2_recv_parse_match+0x87>
lea    0xe4c(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <minipmi_find_integer_value_by_key@plt>
test   %eax,%eax
jne    11d9 <minipmi_version2_recv_parse_match+0x89>
cmpl   $0x0,0xc(%rsp)
mov    $0xffffffff,%eax
jne    11d9 <minipmi_version2_recv_parse_match+0x89>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.minipmi_context = type opaque
@.str = [4 x i8] c"cmd\00"
@.str.1 = [3 x i8] c"rc\00"
define i32 @minipmi_version2_recv_parse_match(%struct.minipmi_context* %0, i8* %1, i1 zeroext %2) {
%4 = alloca i32
%5 = alloca %struct.minipmi_context*
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store %struct.minipmi_context* %0, %struct.minipmi_context** %5
store i8* %1, i8** %6
%11 = zext i1 %2 to i8
store i8 %11, i8* %7
%12 = load %struct.minipmi_context*, %struct.minipmi_context** %5
%13 = call i32 (%struct.minipmi_context*, ...) bitcast (i32 (...)* @minipmi_version2_recv to i32 (%struct.minipmi_context*, ...)*)(%struct.minipmi_context* %12)
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = icmp ne i32 %14, 0
%16 = xor i1 %15, true
%17 = xor i1 %16, true
%18 = zext i1 %17 to i32
%19 = sext i32 %18 to i64
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %3
%22 = load i32, i32* %8
store i32 %22, i32* %4
br label %81
23: ; preds = %3
%24 = load %struct.minipmi_context*, %struct.minipmi_context** %5
%25 = call i32 (%struct.minipmi_context*, ...) bitcast (i32 (...)* @minipmi_version2_parse to i32 (%struct.minipmi_context*, ...)*)(%struct.minipmi_context* %24)
store i32 %25, i32* %8
%26 = load i32, i32* %8
%27 = icmp ne i32 %26, 0
%28 = xor i1 %27, true
%29 = xor i1 %28, true
%30 = zext i1 %29 to i32
%31 = sext i32 %30 to i64
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %23
%34 = load i32, i32* %8
store i32 %34, i32* %4
br label %81
35: ; preds = %23
%36 = load %struct.minipmi_context*, %struct.minipmi_context** %5
%37 = call i32 (%struct.minipmi_context*, i8*, ...) bitcast (i32 (...)* @minipmi_find_value_by_key to i32 (%struct.minipmi_context*, i8*, ...)*)(%struct.minipmi_context* %36, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%38 = sext i32 %37 to i64
%39 = inttoptr i64 %38 to i8*
store i8* %39, i8** %10
%40 = load i8*, i8** %10
%41 = icmp ne i8* %40, null
%42 = xor i1 %41, true
%43 = xor i1 %42, true
%44 = xor i1 %43, true
%45 = zext i1 %44 to i32
%46 = sext i32 %45 to i64
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %35
store i32 -1, i32* %4
br label %81
49: ; preds = %35
%50 = load i8*, i8** %10
%51 = load i8*, i8** %6
%52 = call i32 @strcmp(i8* %50, i8* %51)
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %55
54: ; preds = %49
store i32 -2, i32* %4
br label %81
55: ; preds = %49
%56 = load i8, i8* %7
%57 = trunc i8 %56 to i1
br i1 %57, label %58, label %80
58: ; preds = %55
%59 = load %struct.minipmi_context*, %struct.minipmi_context** %5
%60 = call i32 (%struct.minipmi_context*, i8*, i32*, ...) bitcast (i32 (...)* @minipmi_find_integer_value_by_key to i32 (%struct.minipmi_context*, i8*, i32*, ...)*)(%struct.minipmi_context* %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
store i32 %60, i32* %8
%61 = load i32, i32* %8
%62 = icmp ne i32 %61, 0
%63 = xor i1 %62, true
%64 = xor i1 %63, true
%65 = zext i1 %64 to i32
%66 = sext i32 %65 to i64
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %58
%69 = load i32, i32* %8
store i32 %69, i32* %4
br label %81
70: ; preds = %58
%71 = load i32, i32* %9
%72 = icmp ne i32 0, %71
%73 = xor i1 %72, true
%74 = xor i1 %73, true
%75 = zext i1 %74 to i32
%76 = sext i32 %75 to i64
%77 = icmp ne i64 %76, 0
br i1 %77, label %78, label %79
78: ; preds = %70
store i32 -1, i32* %4
br label %81
79: ; preds = %70
br label %80
80: ; preds = %79, %55
store i32 0, i32* %4
br label %81
81: ; preds = %80, %78, %68, %54, %48, %33, %21
%82 = load i32, i32* %4
ret i32 %82
}

LLVM IR (-O2):
%struct.minipmi_context = type opaque
@.str = [4 x i8] c"cmd\00"
@.str.1 = [3 x i8] c"rc\00"
define i32 @minipmi_version2_recv_parse_match(%struct.minipmi_context* %0, i8* nocapture %1, i1 zeroext %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = tail call i32 (%struct.minipmi_context*, ...) bitcast (i32 (...)* @minipmi_version2_recv to i32 (%struct.minipmi_context*, ...)*)(%struct.minipmi_context* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %27
8: ; preds = %3
%9 = tail call i32 (%struct.minipmi_context*, ...) bitcast (i32 (...)* @minipmi_version2_parse to i32 (%struct.minipmi_context*, ...)*)(%struct.minipmi_context* %0)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = tail call i32 (%struct.minipmi_context*, i8*, ...) bitcast (i32 (...)* @minipmi_find_value_by_key to i32 (%struct.minipmi_context*, i8*, ...)*)(%struct.minipmi_context* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %27, label %14
14: ; preds = %11
%15 = sext i32 %12 to i64
%16 = inttoptr i64 %15 to i8*
%17 = tail call i32 @strcmp(i8* %16, i8* dereferenceable(1) %1)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %27
19: ; preds = %14
br i1 %2, label %20, label %26
20: ; preds = %19
%21 = call i32 (%struct.minipmi_context*, i8*, i32*, ...) bitcast (i32 (...)* @minipmi_find_integer_value_by_key to i32 (%struct.minipmi_context*, i8*, i32*, ...)*)(%struct.minipmi_context* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load i32, i32* %4
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %23, %19
br label %27
27: ; preds = %23, %20, %14, %11, %8, %3, %26
%28 = phi i32 [ 0, %26 ], [ %6, %3 ], [ %9, %8 ], [ -1, %11 ], [ -2, %14 ], [ %21, %20 ], [ -1, %23 ]
ret i32 %28
}