#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 ide_sense_error(char *);
int /*<<< orphan*/ printf(char *, ...);
void ide_print_sense_error() {
  char buf[10];
  if (ide_sense_error(buf) != 10) {
    printf("ERROR - Sense error failed!\n");
    return;
  }
  int major = buf[2] & 0xFF;
  int minor = buf[8] & 0xFF;
  printf("[IDE] Error code %02X,%02X\n", major, minor);
}


x86 assembly (clang, -O0):
<ide_print_sense_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0xa(%rbp),%rdi
call   1040 <ide_sense_error@plt>
cmp    $0xa,%eax
je     114d <ide_print_sense_error+0x2d>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1179 <ide_print_sense_error+0x59>
movsbl -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x10(%rbp)
movsbl -0x2(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ide_print_sense_error>:
sub    $0x18,%rsp
lea    0xe(%rsp),%rdi
call   1050 <ide_sense_error@plt>
cmp    $0xa,%eax
jne    1160 <ide_print_sense_error+0x30>
movzbl 0x10(%rsp),%esi
movzbl 0x16(%rsp),%edx
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x18,%rsp
ret
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"ERROR - Sense error failed!\0A\00"
@.str.1 = [28 x i8] c"[IDE] Error code %02X,%02X\0A\00"
define void @ide_print_sense_error() {
%1 = alloca [10 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%5 = call i32 @ide_sense_error(i8* %4)
%6 = icmp ne i32 %5, 10
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %21
9: ; preds = %0
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = and i32 %12, 255
store i32 %13, i32* %2
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 8
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = and i32 %16, 255
store i32 %17, i32* %3
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %19)
br label %21
21: ; preds = %9, %7
ret void
}

LLVM IR (-O2):
@.str.1 = [28 x i8] c"[IDE] Error code %02X,%02X\0A\00"
@str = [28 x i8] c"ERROR - Sense error failed!\00"
define void @ide_print_sense_error() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @ide_sense_error(i8* %2)
%4 = icmp eq i32 %3, 10
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %15
7: ; preds = %0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 2
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 8
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %13)
br label %15
15: ; preds = %7, %5
ret void
}