#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*/ mstb;
typedef int /*<<< orphan*/ msta;
typedef int /*<<< orphan*/ b;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a, b[3];
  struct sta {
    char a, b;
    int c;
  } msta;
  struct stb {
    char a;
    int c;
    char b;
  } mstb;
  printf("tamanho de int a: %d\n", sizeof(a));
  printf("tamanho de int b[3]: %d\n", sizeof(b));
  printf("tamanho de struct sta msta: %d\n", sizeof(msta));
  printf("tamanho de struct stb mstb: %d\n", sizeof(mstb));
  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
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sta = type { i8, i8, i32 }
%struct.stb = type { i8, i32, i8 }
@.str = [22 x i8] c"tamanho de int a: %d\0A\00"
@.str.1 = [25 x i8] c"tamanho de int b[3]: %d\0A\00"
@.str.2 = [32 x i8] c"tamanho de struct sta msta: %d\0A\00"
@.str.3 = [32 x i8] c"tamanho de struct stb mstb: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x i32]
%4 = alloca %struct.sta
%5 = alloca %struct.stb
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 4)
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 12)
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 8)
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 12)
ret i32 0
}

LLVM IR (-O2):
%struct.sta = type { i8, i8, i32 }
%struct.stb = type { i8, i32, i8 }
@.str = [22 x i8] c"tamanho de int a: %d\0A\00"
@.str.1 = [25 x i8] c"tamanho de int b[3]: %d\0A\00"
@.str.2 = [32 x i8] c"tamanho de struct sta msta: %d\0A\00"
@.str.3 = [32 x i8] c"tamanho de struct stb mstb: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 12)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 8)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 12)
ret i32 0
}