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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void show_edid_data(FILE *outfile, unsigned char *edid_data, int items,
                    int base) {
  int item = 0;
  while (item < items) {
    int i;
    fprintf(outfile, " 0x%04x:  ", item + base);
    for (i = 0; i < 16; i++) {
      fprintf(outfile, "%02x ", edid_data[item++]);
      if (item >= items)
        break;
    }
    fprintf(outfile, "\n");
  }
}


x86 assembly (clang, -O0):
<show_edid_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c5 <show_edid_data+0xb5>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
add    -0x18(%rbp),%edx
lea    0xeb6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x10,-0x20(%rbp)
jge    11ae <show_edid_data+0x9e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xe88(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     119b <show_edid_data+0x8b>
jmp    11ae <show_edid_data+0x9e>
jmp    11a0 <show_edid_data+0x90>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1158 <show_edid_data+0x48>
mov    -0x8(%rbp),%rdi
lea    0xe58(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    112d <show_edid_data+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_edid_data>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,0x18(%rsp)
mov    %rsi,0x10(%rsp)
mov    %edx,0xc(%rsp)
test   %edx,%edx
jle    11cf <show_edid_data+0xaf>
mov    %rdi,%rbx
mov    0xc(%rsp),%r12d
xor    %ebp,%ebp
jmp    116a <show_edid_data+0x4a>
mov    0x20(%rsp),%rbp
add    %eax,%ebp
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
cmp    0xc(%rsp),%ebp
jge    11cf <show_edid_data+0xaf>
mov    0x18(%rsp),%rax
lea    (%rax,%rbp,1),%edx
mov    %rbx,%rdi
lea    0xe84(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %rbp,0x20(%rsp)
movslq %ebp,%r15
mov    0x10(%rsp),%rax
lea    (%rax,%r15,1),%r13
add    $0x1,%r15
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
lea    (%r15,%r14,1),%rbp
movzbl 0x0(%r13,%r14,1),%edx
mov    %rbx,%rdi
lea    0xe57(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0x1(%r14),%rax
cmp    %r12,%rbp
jge    1150 <show_edid_data+0x30>
cmp    $0xf,%r14d
mov    %rax,%r14
jb     11a0 <show_edid_data+0x80>
jmp    1150 <show_edid_data+0x30>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c" 0x%04x: \00"
@.str.1 = [6 x i8] c"%02x \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @show_edid_data(i32* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %11
11: ; preds = %42, %4
%12 = load i32, i32* %9
%13 = load i32, i32* %7
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %45
15: ; preds = %11
%16 = load i32*, i32** %5
%17 = load i32, i32* %9
%18 = load i32, i32* %8
%19 = add nsw i32 %17, %18
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %19)
store i32 0, i32* %10
br label %21
21: ; preds = %39, %15
%22 = load i32, i32* %10
%23 = icmp slt i32 %22, 16
br i1 %23, label %24, label %42
24: ; preds = %21
%25 = load i32*, i32** %5
%26 = load i8*, i8** %6
%27 = load i32, i32* %9
%28 = add nsw i32 %27, 1
store i32 %28, i32* %9
%29 = sext i32 %27 to i64
%30 = getelementptr inbounds i8, i8* %26, i64 %29
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %9
%35 = load i32, i32* %7
%36 = icmp sge i32 %34, %35
br i1 %36, label %37, label %38
37: ; preds = %24
br label %42
38: ; preds = %24
br label %39
39: ; preds = %38
%40 = load i32, i32* %10
%41 = add nsw i32 %40, 1
store i32 %41, i32* %10
br label %21
42: ; preds = %37, %21
%43 = load i32*, i32** %5
%44 = call i32 (i32*, i8*, ...) @fprintf(i32* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %11
45: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c" 0x%04x: \00"
@.str.1 = [6 x i8] c"%02x \00"
define void @show_edid_data(i32* nocapture %0, i8* nocapture %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %29
6: ; preds = %4
%7 = zext i32 %2 to i64
br label %8
8: ; preds = %6, %25
%9 = phi i32 [ %26, %25 ], [ 0, %6 ]
%10 = add nsw i32 %9, %3
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = sext i32 %9 to i64
br label %13
13: ; preds = %13, %8
%14 = phi i64 [ %16, %13 ], [ %12, %8 ]
%15 = phi i32 [ %22, %13 ], [ 0, %8 ]
%16 = add nsw i64 %14, 1
%17 = getelementptr inbounds i8, i8* %1, i64 %14
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = icmp slt i64 %16, %7
%22 = add nuw nsw i32 %15, 1
%23 = icmp ult i32 %15, 15
%24 = select i1 %21, i1 %23, i1 false
br i1 %24, label %13, label %25
25: ; preds = %13
%26 = trunc i64 %16 to i32
%27 = tail call i32 @fputc(i32 10, i32* %0)
%28 = icmp slt i32 %26, %2
br i1 %28, label %8, label %29
29: ; preds = %25, %4
ret void
}