#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*/ dbgprintf(char *, ...);
void printBytes(unsigned int num) {
  int i = 0;
  for (i = 0; i < sizeof(unsigned int); i++) {
    unsigned char *byte = (unsigned char *)&num;
    dbgprintf("%d|", byte[i]);
  }
  dbgprintf("\n");
}


x86 assembly (clang, -O0):
<printBytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmp    $0x4,%rax
jae    1167 <printBytes+0x57>
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <dbgprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <printBytes+0x19>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <dbgprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printBytes>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %edi,%ebp
shr    $0x10,%ebp
mov    %edi,%r15d
shr    $0x18,%r15d
movzbl %bl,%esi
lea    0xed1(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <dbgprintf@plt>
movzbl %bh,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <dbgprintf@plt>
movzbl %bpl,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <dbgprintf@plt>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <dbgprintf@plt>
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <dbgprintf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d|\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @printBytes(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %3
br label %5
5: ; preds = %18, %1
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = icmp ult i64 %7, 4
br i1 %8, label %9, label %21
9: ; preds = %5
%10 = bitcast i32* %2 to i8*
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = call i32 (i8*, ...) @dbgprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %9
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %5
21: ; preds = %5
%22 = call i32 (i8*, ...) @dbgprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d|\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @printBytes(i32 %0) {
%2 = lshr i32 %0, 8
%3 = lshr i32 %0, 16
%4 = lshr i32 %0, 24
%5 = and i32 %0, 255
%6 = tail call i32 (i8*, ...) @dbgprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = and i32 %2, 255
%8 = tail call i32 (i8*, ...) @dbgprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = and i32 %3, 255
%10 = tail call i32 (i8*, ...) @dbgprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = tail call i32 (i8*, ...) @dbgprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%12 = tail call i32 (i8*, ...) @dbgprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}