#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 *, uintptr_t, ...);
void sizeof_test(void) {
  int a;
  int **ptr;
  printf("sizeof(int) = %lu\n", sizeof(int));
  printf("sizeof(unsigned int) = %lu\n", sizeof(unsigned int));
  printf("sizeof(long) = %lu\n", sizeof(long));
  printf("sizeof(unsigned long) = %lu\n", sizeof(unsigned long));
  printf("sizeof(short) = %lu\n", sizeof(short));
  printf("sizeof(unsigned short) = %lu\n", sizeof(unsigned short));
  printf("sizeof(char) = %lu\n", sizeof(char));
  printf("sizeof(unsigned char) = %lu\n", sizeof(unsigned char));
  a = 1;
  printf("sizeof(a++) = %lu\n", sizeof a++);
  printf("a=%d\n", a);
  ptr = NULL;
  printf("sizeof(**ptr) = %lu\n", sizeof(**ptr));
  printf("sizeof(sizeof(int) = %lu\n", sizeof(sizeof(int)));
  {
    uintptr_t t = 1;
    uintptr_t t2;
    t <<= 16;
    t <<= 16;
    t++;
    t2 = t & -sizeof(uintptr_t);
    printf("%lu %lu\n", t, t2);
  }
}


x86 assembly (clang, -O0):
<sizeof_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xfc7(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
lea    0xef3(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x4(%rbp),%rsi
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x10(%rbp)
lea    0xedf(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
and    $0xfffffffffffffff8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sizeof_test>:
push   %rax
lea    0xfce(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf01(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf01(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movabs $0x100000000,%rdx
lea    0x1(%rdx),%rsi
lea    0xeef(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"sizeof(int) = %lu\0A\00"
@.str.1 = [28 x i8] c"sizeof(unsigned int) = %lu\0A\00"
@.str.2 = [20 x i8] c"sizeof(long) = %lu\0A\00"
@.str.3 = [29 x i8] c"sizeof(unsigned long) = %lu\0A\00"
@.str.4 = [21 x i8] c"sizeof(short) = %lu\0A\00"
@.str.5 = [30 x i8] c"sizeof(unsigned short) = %lu\0A\00"
@.str.6 = [20 x i8] c"sizeof(char) = %lu\0A\00"
@.str.7 = [29 x i8] c"sizeof(unsigned char) = %lu\0A\00"
@.str.8 = [19 x i8] c"sizeof(a++) = %lu\0A\00"
@.str.9 = [6 x i8] c"a=%d\0A\00"
@.str.10 = [21 x i8] c"sizeof(**ptr) = %lu\0A\00"
@.str.11 = [26 x i8] c"sizeof(sizeof(int) = %lu\0A\00"
@.str.12 = [9 x i8] c"%lu %lu\0A\00"
define void @sizeof_test() {
%1 = alloca i32
%2 = alloca i32**
%3 = alloca i64
%4 = alloca i64
%5 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i64 4)
%6 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i64 4)
%7 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i64 8)
%8 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i64 8)
%9 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i64 2)
%10 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i64 2)
%11 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i64 1)
%12 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i64 1)
store i32 1, i32* %1
%13 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i64 4)
%14 = load i32, i32* %1
%15 = sext i32 %14 to i64
%16 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i64 %15)
store i32** null, i32*** %2
%17 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i64 4)
%18 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i64 8)
store i64 1, i64* %3
%19 = load i64, i64* %3
%20 = shl i64 %19, 16
store i64 %20, i64* %3
%21 = load i64, i64* %3
%22 = shl i64 %21, 16
store i64 %22, i64* %3
%23 = load i64, i64* %3
%24 = add i64 %23, 1
store i64 %24, i64* %3
%25 = load i64, i64* %3
%26 = and i64 %25, -8
store i64 %26, i64* %4
%27 = load i64, i64* %3
%28 = load i64, i64* %4
%29 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i64 %27, i64 %28)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"sizeof(int) = %lu\0A\00"
@.str.1 = [28 x i8] c"sizeof(unsigned int) = %lu\0A\00"
@.str.2 = [20 x i8] c"sizeof(long) = %lu\0A\00"
@.str.3 = [29 x i8] c"sizeof(unsigned long) = %lu\0A\00"
@.str.4 = [21 x i8] c"sizeof(short) = %lu\0A\00"
@.str.5 = [30 x i8] c"sizeof(unsigned short) = %lu\0A\00"
@.str.6 = [20 x i8] c"sizeof(char) = %lu\0A\00"
@.str.7 = [29 x i8] c"sizeof(unsigned char) = %lu\0A\00"
@.str.8 = [19 x i8] c"sizeof(a++) = %lu\0A\00"
@.str.9 = [6 x i8] c"a=%d\0A\00"
@.str.10 = [21 x i8] c"sizeof(**ptr) = %lu\0A\00"
@.str.11 = [26 x i8] c"sizeof(sizeof(int) = %lu\0A\00"
@.str.12 = [9 x i8] c"%lu %lu\0A\00"
define void @sizeof_test() {
%1 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i64 4)
%2 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i64 4)
%3 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i64 8)
%4 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i64 8)
%5 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i64 2)
%6 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i64 2)
%7 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i64 1)
%8 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i64 1)
%9 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i64 4)
%10 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i64 1)
%11 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i64 4)
%12 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i64 8)
%13 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i64 4294967297, i64 4294967296)
ret void
}