#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*/ printf(char *, unsigned char);
int main(void) {
  unsigned x = 0xAABBCCDD;
  unsigned char *p;
  for (p = &x; p < (unsigned char *)&x + 4; p++)
    printf("%x\n", *p);
  p = &x;
  printf("%x\n", p[0]);
  printf("%x\n", p[1]);
  printf("%x\n", p[2]);
  printf("%x\n", p[3]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xaabbccdd,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    -0x8(%rbp),%rcx
add    $0x4,%rcx
cmp    %rcx,%rax
jae    1167 <main+0x57>
mov    -0x10(%rbp),%rax
lea    0xeb2(%rip),%rdi
movzbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112e <main+0x1e>
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    0xe86(%rip),%rdi
movzbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
lea    0xe73(%rip),%rdi
movzbl 0x1(%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
lea    0xe5f(%rip),%rdi
movzbl 0x2(%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
lea    0xe4b(%rip),%rdi
movzbl 0x3(%rax),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xdd,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xcc,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xbb,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xaa,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xdd,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xcc,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xbb,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xaa,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
store i32 -1430532899, i32* %2
%4 = bitcast i32* %2 to i8*
store i8* %4, i8** %3
br label %5
5: ; preds = %14, %0
%6 = load i8*, i8** %3
%7 = bitcast i32* %2 to i8*
%8 = getelementptr inbounds i8, i8* %7, i64 4
%9 = icmp ult i8* %6, %8
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext %12)
br label %14
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %3
br label %5
17: ; preds = %5
%18 = bitcast i32* %2 to i8*
store i8* %18, i8** %3
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext %21)
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = load i8, i8* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext %25)
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i64 2
%29 = load i8, i8* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext %29)
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i64 3
%33 = load i8, i8* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%x\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext -35)
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext -52)
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext -69)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext -86)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext -35)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext -52)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext -69)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext -86)
ret i32 0
}