#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 */
typedef int /*<<< orphan*/ x;

/* Variables and functions */
int CHAR_BIT;
int ULONG_MAX;
int /*<<< orphan*/ printf(char *, int);
int main() {
  unsigned long x = ~0;
  unsigned long y = (unsigned long)-1;
  printf("%lu\n", x);
  printf("%lu\n", y);
  printf("%lu\n", ULONG_MAX);
  printf("%lu bytes\n", sizeof(x));
  printf("%lu bits\n", sizeof(x) * CHAR_BIT);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0xffffffffffffffff,-0x10(%rbp)
ff
movq   $0xffffffffffffffff,-0x18(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    %eax,%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    0x2e60(%rip),%rax
movslq (%rax),%rax
shl    $0x3,%rax
mov    %eax,%esi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%esi
shl    $0x3,%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lu\0A\00"
@ULONG_MAX = global i32 0
@.str.1 = [11 x i8] c"%lu bytes\0A\00"
@.str.2 = [10 x i8] c"%lu bits\0A\00"
@CHAR_BIT = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store i64 -1, i64* %2
store i64 -1, i64* %3
%4 = load i64, i64* %2
%5 = trunc i64 %4 to i32
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i64, i64* %3
%8 = trunc i64 %7 to i32
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @ULONG_MAX
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 8)
%13 = load i32, i32* @CHAR_BIT
%14 = sext i32 %13 to i64
%15 = mul i64 8, %14
%16 = trunc i64 %15 to i32
%17 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lu\0A\00"
@ULONG_MAX = global i32 0
@.str.1 = [11 x i8] c"%lu bytes\0A\00"
@.str.2 = [10 x i8] c"%lu bits\0A\00"
@CHAR_BIT = global i32 0
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 -1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 -1)
%3 = load i32, i32* @ULONG_MAX
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 8)
%6 = load i32, i32* @CHAR_BIT
%7 = shl i32 %6, 3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %7)
ret i32 0
}