#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 unsigned int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void display_frame(uint8_t *frame, uint32_t size) {
  fprintf(stdout, "frame : \n");
  for (unsigned int i = 0; i < size; i++) {
    if ((i == 5) || (i == 6))
      fprintf(stdout, "%c ", frame[i]);
    else
      fprintf(stdout, "%.2x ", frame[i]);
  }
  fprintf(stdout, "\n");
}


x86 assembly (clang, -O0):
<display_frame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11b7 <display_frame+0xa7>
cmpl   $0x5,-0x10(%rbp)
je     115d <display_frame+0x4d>
cmpl   $0x6,-0x10(%rbp)
jne    1183 <display_frame+0x73>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,4),%edx
lea    0xe93(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11a4 <display_frame+0x94>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,4),%edx
lea    0xe71(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11a9 <display_frame+0x99>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113d <display_frame+0x2d>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
lea    0xe41(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_frame>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r13
mov    0x2eb8(%rip),%r15
mov    (%r15),%edi
lea    0xece(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %r14d,%r14d
je     1185 <display_frame+0x75>
mov    %r14d,%ebp
lea    0xec2(%rip),%r14
lea    0xebf(%rip),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x5(%rbx),%eax
cmp    $0x2,%eax
mov    (%r15),%edi
mov    0x0(%r13,%rbx,4),%edx
mov    %r12,%rsi
cmovb  %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <display_frame+0x50>
mov    (%r15),%edi
lea    0xe79(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [10 x i8] c"frame : \0A\00"
@.str.1 = [4 x i8] c"%c \00"
@.str.2 = [6 x i8] c"%.2x \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @display_frame(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %1, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %11
8: ; preds = %11, %2
%9 = load i32, i32* @stdout
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
11: ; preds = %6, %11
%12 = phi i64 [ 0, %6 ], [ %21, %11 ]
%13 = trunc i64 %12 to i32
%14 = add i32 %13, -5
%15 = icmp ult i32 %14, 2
%16 = load i32, i32* @stdout
%17 = getelementptr inbounds i32, i32* %0, i64 %12
%18 = load i32, i32* %17
%19 = select i1 %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* %19, i32 %18)
%21 = add nuw nsw i64 %12, 1
%22 = icmp eq i64 %21, %7
br i1 %22, label %8, label %11
}