#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 long);
int main(int argc, const char *argv[]) {
  unsigned long a = 0x00000001;
  unsigned long b = 0x0;
  for (int i = 0; i < 31; i++) {
    a = a << 2;
    a = a | 0x1;
    printf("Hex: 0x%lx\n", a);
  }
  printf("Decimal: %lu\n", a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x1f,-0x24(%rbp)
jge    117d <main+0x6d>
mov    -0x18(%rbp),%rax
shl    $0x2,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
or     $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113d <main+0x2d>
mov    -0x18(%rbp),%rsi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%ebx
mov    $0x1f,%ebp
lea    0xedb(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(,%rbx,4),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jne    1130 <main+0x20>
lea    0xebd(%rip),%rdi
movabs $0x5555555555555555,%rsi
55 55 55
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Hex: 0x%lx\0A\00"
@.str.1 = [14 x i8] c"Decimal: %lu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 1, i64* %6
store i64 0, i64* %7
store i32 0, i32* %8
br label %9
9: ; preds = %19, %2
%10 = load i32, i32* %8
%11 = icmp slt i32 %10, 31
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load i64, i64* %6
%14 = shl i64 %13, 2
store i64 %14, i64* %6
%15 = load i64, i64* %6
%16 = or i64 %15, 1
store i64 %16, i64* %6
%17 = load i64, i64* %6
%18 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %17)
br label %19
19: ; preds = %12
%20 = load i32, i32* %8
%21 = add nsw i32 %20, 1
store i32 %21, i32* %8
br label %9
22: ; preds = %9
%23 = load i64, i64* %6
%24 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i64 %23)
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hex: 0x%lx\0A\00"
@.str.1 = [14 x i8] c"Decimal: %lu\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %5
3: ; preds = %5
%4 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i64 6148914691236517205)
ret i32 0
5: ; preds = %2, %5
%6 = phi i32 [ 0, %2 ], [ %11, %5 ]
%7 = phi i64 [ 1, %2 ], [ %9, %5 ]
%8 = shl i64 %7, 2
%9 = or i64 %8, 1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %9)
%11 = add nuw nsw i32 %6, 1
%12 = icmp eq i32 %11, 31
br i1 %12, label %3, label %5
}