#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*/ afedriusb_command(unsigned char *);
short int get_eeprom_data(unsigned char VirtAddress) {
  unsigned char report[7];
  short int *dat;
  int i;
  dat = (short int *)&report[2];
  report[0] = 2;
  report[1] = 0x55;
  report[2] = VirtAddress;
  for (i = 3; i < 7; i++)
    report[i] = 0;
  afedriusb_command(report);
  return dat[0];
}


x86 assembly (clang, -O0):
<get_eeprom_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
movb   $0x2,-0x8(%rbp)
movb   $0x55,-0x7(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x6(%rbp)
movl   $0x3,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    1160 <get_eeprom_data+0x50>
movslq -0x14(%rbp),%rax
movb   $0x0,-0x8(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113f <get_eeprom_data+0x2f>
lea    -0x8(%rbp),%rdi
call   1030 <afedriusb_command@plt>
mov    -0x10(%rbp),%rax
movswl (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_eeprom_data>:
push   %rax
movw   $0x5502,0x1(%rsp)
mov    %dil,0x3(%rsp)
movl   $0x0,0x4(%rsp)
lea    0x1(%rsp),%rdi
call   1030 <afedriusb_command@plt>
movzwl 0x3(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define signext i16 @get_eeprom_data(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca [7 x i8]
%4 = alloca i16*
%5 = alloca i32
store i8 %0, i8* %2
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 2
%7 = bitcast i8* %6 to i16*
store i16* %7, i16** %4
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
store i8 2, i8* %8
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 1
store i8 85, i8* %9
%10 = load i8, i8* %2
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 2
store i8 %10, i8* %11
store i32 3, i32* %5
br label %12
12: ; preds = %19, %1
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 7
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 %17
store i8 0, i8* %18
br label %19
19: ; preds = %15
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %12
22: ; preds = %12
%23 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%24 = call i32 @afedriusb_command(i8* %23)
%25 = load i16*, i16** %4
%26 = getelementptr inbounds i16, i16* %25, i64 0
%27 = load i16, i16* %26
ret i16 %27
}

LLVM IR (-O2):
define signext i16 @get_eeprom_data(i8 zeroext %0) {
%2 = alloca [7 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 2
store i8 2, i8* %3
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 1
store i8 85, i8* %5
store i8 %0, i8* %4
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 3
%7 = bitcast i8* %6 to i32*
store i32 0, i32* %7
%8 = bitcast i8* %4 to i16*
%9 = call i32 @afedriusb_command(i8* %3)
%10 = load i16, i16* %8
ret i16 %10
}