#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 /*<<< orphan*/ dumpbuf;

/* Variables and functions */
int /*<<< orphan*/ EEPROM_Read(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
void EEPROM_Dump(void) {
  uint8_t dumpbuf[256];
  EEPROM_Read(dumpbuf, 0, sizeof(dumpbuf));
  printf("\nEEPROM contents:");
  for (int i = 0; i < sizeof(dumpbuf); i++) {
    if ((i & 0x0f) == 0) {
      printf("\n0x%04x:", i);
    }
    printf(" %02x", dumpbuf[i]);
  }
}


x86 assembly (clang, -O0):
<EEPROM_Dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
lea    -0x400(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1030 <EEPROM_Read@plt>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x404(%rbp)
movslq -0x404(%rbp),%rax
cmp    $0x400,%rax
jae    11bf <EEPROM_Dump+0x9f>
mov    -0x404(%rbp),%eax
and    $0xf,%eax
cmp    $0x0,%eax
jne    118f <EEPROM_Dump+0x6f>
mov    -0x404(%rbp),%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x404(%rbp),%rax
mov    -0x400(%rbp,%rax,4),%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x404(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x404(%rbp)
jmp    1156 <EEPROM_Dump+0x36>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EEPROM_Dump>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1030 <EEPROM_Read@plt>
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec2(%rip),%r14
lea    0xec4(%rip),%r15
xor    %ebx,%ebx
jmp    117a <EEPROM_Dump+0x5a>
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x400,%rbx
je     118d <EEPROM_Dump+0x6d>
test   $0xf,%bl
jne    1160 <EEPROM_Dump+0x40>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1160 <EEPROM_Dump+0x40>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"\0AEEPROM contents:\00"
@.str.1 = [9 x i8] c"\0A0x%04x:\00"
@.str.2 = [6 x i8] c" %02x\00"
define void @EEPROM_Dump() {
%1 = alloca [256 x i32]
%2 = alloca i32
%3 = getelementptr inbounds [256 x i32], [256 x i32]* %1, i64 0, i64 0
%4 = call i32 @EEPROM_Read(i32* %3, i32 0, i32 1024)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %6
6: ; preds = %23, %0
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = icmp ult i64 %8, 1024
br i1 %9, label %10, label %26
10: ; preds = %6
%11 = load i32, i32* %2
%12 = and i32 %11, 15
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [256 x i32], [256 x i32]* %1, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %17
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %6
26: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"\0AEEPROM contents:\00"
@.str.1 = [9 x i8] c"\0A0x%04x:\00"
@.str.2 = [6 x i8] c" %02x\00"
define void @EEPROM_Dump() {
%1 = alloca [256 x i32]
%2 = bitcast [256 x i32]* %1 to i8*
%3 = getelementptr inbounds [256 x i32], [256 x i32]* %1, i64 0, i64 0
%4 = call i32 @EEPROM_Read(i32* %3, i32 0, i32 1024)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %7
6: ; preds = %14
ret void
7: ; preds = %0, %14
%8 = phi i64 [ 0, %0 ], [ %18, %14 ]
%9 = trunc i64 %8 to i32
%10 = and i32 %9, 15
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %14
14: ; preds = %12, %7
%15 = getelementptr inbounds [256 x i32], [256 x i32]* %1, i64 0, i64 %8
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = add nuw nsw i64 %8, 1
%19 = icmp eq i64 %18, 1024
br i1 %19, label %6, label %7
}