#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 *, ...);
int main(void) {
  unsigned num;
  unsigned i;
  void *ptr;
  num = 0;
  for (i = 0; i < sizeof(int); i++)
    num = (num << 8) | ('a' + i);
  ptr = (void *)&num;
  printf("%u\n", num);
  for (i = 0; i < sizeof(int); i++)
    printf("%c", ((char *)ptr)[i]);
  printf("\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    $0x4,%rax
jae    1159 <main+0x49>
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
mov    -0xc(%rbp),%ecx
add    $0x61,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    $0x4,%rax
jae    11ad <main+0x9d>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsbl (%rax,%rcx,1),%esi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1179 <main+0x69>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x61626364,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x64,%edi
call   1030 <putchar@plt>
mov    $0x63,%edi
call   1030 <putchar@plt>
mov    $0x62,%edi
call   1030 <putchar@plt>
mov    $0x61,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1633837924)
%2 = tail call i32 @putchar(i32 100)
%3 = tail call i32 @putchar(i32 99)
%4 = tail call i32 @putchar(i32 98)
%5 = tail call i32 @putchar(i32 97)
%6 = tail call i32 @putchar(i32 10)
ret i32 0
}