#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*/ putchar(char);
int main(int argc, char *argv[]) {
  int c;
  int i;
  union {
    int i;
    char b[4];
  } b4;
  for (i = 0; i < 1024; i++) {
    b4.i = i;
    putchar(b4.b[0]);
    putchar(b4.b[1]);
    putchar(b4.b[2]);
    putchar(b4.b[3]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x400,-0x18(%rbp)
jge    1172 <main+0x62>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
movsbl -0x20(%rbp),%edi
call   1030 <putchar@plt>
movsbl -0x1f(%rbp),%edi
call   1030 <putchar@plt>
movsbl -0x1e(%rbp),%edi
call   1030 <putchar@plt>
movsbl -0x1d(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%ebp
shr    $0x8,%ebp
mov    %ebx,%r14d
shr    $0x10,%r14d
movsbl %bl,%edi
call   1030 <putchar@plt>
movsbl %bpl,%edi
call   1030 <putchar@plt>
movsbl %r14b,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
sar    $0x18,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    $0x400,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %union.anon
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %9
9: ; preds = %31, %2
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 1024
br i1 %11, label %12, label %34
12: ; preds = %9
%13 = load i32, i32* %7
%14 = bitcast %union.anon* %8 to i32*
store i32 %13, i32* %14
%15 = bitcast %union.anon* %8 to [4 x i8]*
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %15, i64 0, i64 0
%17 = load i8, i8* %16
%18 = call i32 @putchar(i8 signext %17)
%19 = bitcast %union.anon* %8 to [4 x i8]*
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %19, i64 0, i64 1
%21 = load i8, i8* %20
%22 = call i32 @putchar(i8 signext %21)
%23 = bitcast %union.anon* %8 to [4 x i8]*
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %23, i64 0, i64 2
%25 = load i8, i8* %24
%26 = call i32 @putchar(i8 signext %25)
%27 = bitcast %union.anon* %8 to [4 x i8]*
%28 = getelementptr inbounds [4 x i8], [4 x i8]* %27, i64 0, i64 3
%29 = load i8, i8* %28
%30 = call i32 @putchar(i8 signext %29)
br label %31
31: ; preds = %12
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
br label %9
34: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 0, %2 ], [ %16, %3 ]
%5 = trunc i32 %4 to i8
%6 = lshr i32 %4, 8
%7 = trunc i32 %6 to i8
%8 = lshr i32 %4, 16
%9 = trunc i32 %8 to i8
%10 = lshr i32 %4, 24
%11 = trunc i32 %10 to i8
%12 = tail call i32 @putchar(i8 signext %5)
%13 = tail call i32 @putchar(i8 signext %7)
%14 = tail call i32 @putchar(i8 signext %9)
%15 = tail call i32 @putchar(i8 signext %11)
%16 = add nuw nsw i32 %4, 1
%17 = icmp eq i32 %16, 1024
br i1 %17, label %18, label %3
18: ; preds = %3
ret i32 0
}