#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 *, int);
void main() {
#pragma pack(8)
  struct TestStruct4 {
    char a;
    long b;
  };
  struct TestStruct5 {
    char c;
    struct TestStruct4 d;
    long long e;
  };
  printf("sizeof long long:%d\n", sizeof(long long));
  printf("sizeof TestStruct4:%d\n", sizeof(struct TestStruct4));
  printf("sizeof TestStruct5:%d\n", sizeof(struct TestStruct5));
#pragma pack()
  printf("\nsizeof TestStruct4:%d\n", sizeof(struct TestStruct4));
  printf("sizeof TestStruct5:%d\n", sizeof(struct TestStruct5));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xf01(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x20,%esi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x20,%esi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
lea    0xedb(%rip),%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"sizeof long long:%d\0A\00"
@.str.1 = [23 x i8] c"sizeof TestStruct4:%d\0A\00"
@.str.2 = [23 x i8] c"sizeof TestStruct5:%d\0A\00"
@.str.3 = [24 x i8] c"\0Asizeof TestStruct4:%d\0A\00"
define void @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 8)
%2 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 16)
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 32)
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 16)
%5 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 32)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"sizeof long long:%d\0A\00"
@.str.1 = [23 x i8] c"sizeof TestStruct4:%d\0A\00"
@.str.2 = [23 x i8] c"sizeof TestStruct5:%d\0A\00"
@.str.3 = [24 x i8] c"\0Asizeof TestStruct4:%d\0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 8)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 16)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 32)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 16)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 32)
ret void
}