#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 */
typedef int uint8_t;
typedef int int32_t;

/* Variables and functions */
int32_t _ata_health_status(uint8_t status, uint8_t lba_mid, uint8_t lba_high) {
  if ((status >> 5) & ((1 << (5 - 5 + 1)) - 1))
    return 0;
  if ((lba_mid == 0x4f) && (lba_high == 0xc2))
    return 2;
  else if ((lba_mid == 0xf4) && (lba_high == 0x2c))
    return 0;
  return -1;
}


x86 assembly (clang, -O0):
<_ata_health_status>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x5,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     112b <_ata_health_status+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    117d <_ata_health_status+0x7d>
cmpl   $0x4f,-0xc(%rbp)
jne    114e <_ata_health_status+0x4e>
cmpl   $0xc2,-0x10(%rbp)
jne    114e <_ata_health_status+0x4e>
movl   $0x2,-0x4(%rbp)
jmp    117d <_ata_health_status+0x7d>
cmpl   $0xf4,-0xc(%rbp)
jne    1171 <_ata_health_status+0x71>
cmpl   $0x2c,-0x10(%rbp)
jne    1171 <_ata_health_status+0x71>
movl   $0x0,-0x4(%rbp)
jmp    117d <_ata_health_status+0x7d>
jmp    1176 <_ata_health_status+0x76>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ata_health_status>:
xor    %eax,%eax
test   $0x20,%dil
jne    111a <_ata_health_status+0x1a>
cmp    $0x4f,%esi
jne    111b <_ata_health_status+0x1b>
mov    $0x2,%eax
cmp    $0xc2,%edx
jne    111b <_ata_health_status+0x1b>
ret
xor    $0xf4,%esi
xor    $0x2c,%edx
xor    %eax,%eax
or     %esi,%edx
setne  %al
neg    %eax
ret

LLVM IR (-O0):
define i32 @_ata_health_status(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %5
%9 = ashr i32 %8, 5
%10 = and i32 %9, 1
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %3
store i32 0, i32* %4
br label %29
13: ; preds = %3
%14 = load i32, i32* %6
%15 = icmp eq i32 %14, 79
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* %7
%18 = icmp eq i32 %17, 194
br i1 %18, label %19, label %20
19: ; preds = %16
store i32 2, i32* %4
br label %29
20: ; preds = %16, %13
%21 = load i32, i32* %6
%22 = icmp eq i32 %21, 244
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load i32, i32* %7
%25 = icmp eq i32 %24, 44
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 0, i32* %4
br label %29
27: ; preds = %23, %20
br label %28
28: ; preds = %27
store i32 -1, i32* %4
br label %29
29: ; preds = %28, %26, %19, %12
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
define i32 @_ata_health_status(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %0, 32
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = icmp eq i32 %1, 79
%8 = icmp eq i32 %2, 194
%9 = and i1 %7, %8
br i1 %9, label %15, label %10
10: ; preds = %6
%11 = icmp ne i32 %1, 244
%12 = icmp ne i32 %2, 44
%13 = or i1 %11, %12
%14 = sext i1 %13 to i32
br label %15
15: ; preds = %10, %6, %3
%16 = phi i32 [ 0, %3 ], [ 2, %6 ], [ %14, %10 ]
ret i32 %16
}