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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  printf("sizeof int %lu\n", sizeof(int));
  printf("sizeof int* %lu\n", sizeof(int *));
  printf("sizeof double %lu\n", sizeof(double));
  printf("sizeof long %lu\n", sizeof(long));
  printf("sizeof long double %lu\n", sizeof(long double));
  typedef struct {
    char a;
    int b;
  } sizeof_test;
  typedef struct {
    char a;
    int b;
  } __attribute__((__packed__)) sizeof_test_pack;
  sizeof_test st[2];
  printf("sizeof struct %lu\n", sizeof(sizeof_test));
  printf("sizeof struct st %lu %lu\n", sizeof st, sizeof(st));
  sizeof_test_pack stp[2];
  printf("sizeof struct %lu\n", sizeof(sizeof_test_pack));
  printf("sizeof struct st %lu %lu\n", sizeof stp, sizeof(stp));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%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    0xed5(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0x10,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x10,%esi
mov    $0x10,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%r14
mov    $0x10,%edx
mov    %r14,%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xa,%edx
mov    %r14,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sizeof_test = type { i8, i32 }
%struct.sizeof_test_pack = type <{ i8, i32 }>
@.str = [16 x i8] c"sizeof int %lu\0A\00"
@.str.1 = [17 x i8] c"sizeof int* %lu\0A\00"
@.str.2 = [19 x i8] c"sizeof double %lu\0A\00"
@.str.3 = [17 x i8] c"sizeof long %lu\0A\00"
@.str.4 = [24 x i8] c"sizeof long double %lu\0A\00"
@.str.5 = [19 x i8] c"sizeof struct %lu\0A\00"
@.str.6 = [26 x i8] c"sizeof struct st %lu %lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x %struct.sizeof_test]
%3 = alloca [2 x %struct.sizeof_test_pack]
store i32 0, i32* %1
%4 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 4)
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 8)
%6 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 8)
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 8)
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 16)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 8)
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 16, i64 16)
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 5)
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 10, i64 10)
ret i32 0
}

LLVM IR (-O2):
%struct.sizeof_test = type { i8, i32 }
%struct.sizeof_test_pack = type <{ i8, i32 }>
@.str = [16 x i8] c"sizeof int %lu\0A\00"
@.str.1 = [17 x i8] c"sizeof int* %lu\0A\00"
@.str.2 = [19 x i8] c"sizeof double %lu\0A\00"
@.str.3 = [17 x i8] c"sizeof long %lu\0A\00"
@.str.4 = [24 x i8] c"sizeof long double %lu\0A\00"
@.str.5 = [19 x i8] c"sizeof struct %lu\0A\00"
@.str.6 = [26 x i8] c"sizeof struct st %lu %lu\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 4)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 8)
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 8)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 8)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 16)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 8)
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 16, i64 16)
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 5)
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 10, i64 10)
ret i32 0
}