#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;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  uint8_t opcodes[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x00};
  uint8_t *op = opcodes;
  for (;; ++op) {
    printf("%02X\n", *op);
    if (*op == 0x00)
      break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
jne    116c <main+0x5c>
jmp    1182 <main+0x72>
jmp    1171 <main+0x61>
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
jmp    1148 <main+0x38>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0xef2(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xee3(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
cmpl   $0x0,(%rsp)
je     1173 <main+0x63>
lea    0x4(%rsp),%rbx
lea    0xec7(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
cmpl   $0x0,(%rbx)
lea    0x4(%rbx),%rbx
jne    1160 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.opcodes = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 0]
@.str = [6 x i8] c"%02X\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca i32*
store i32 0, i32* %1
%4 = bitcast [6 x i32]* %2 to i8*
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
store i32* %5, i32** %3
br label %6
6: ; preds = %15, %0
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32*, i32** %3
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %6
br label %18
14: ; preds = %6
br label %15
15: ; preds = %14
%16 = load i32*, i32** %3
%17 = getelementptr inbounds i32, i32* %16, i32 1
store i32* %17, i32** %3
br label %6
18: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@__const.main.opcodes = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 0]
@.str = [6 x i8] c"%02X\0A\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %0
%8 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 1
br label %9
9: ; preds = %7, %9
%10 = phi i32* [ %8, %7 ], [ %15, %9 ]
%11 = load i32, i32* %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %10
%14 = icmp eq i32 %13, 0
%15 = getelementptr inbounds i32, i32* %10, i64 1
br i1 %14, label %16, label %9
16: ; preds = %9, %0
ret i32 0
}