int main() {
  char(*a)[10];
  int *p;
  char *b[3];
  char **c;
  p = (int *)malloc(sizeof *p);
  printf("%d\n", sizeof p);
  free(p);
  a = (char(*)[10])malloc(3 * sizeof *a);
  printf("%d\n", sizeof a);
  printf("%d\n", sizeof *a);
  free(a);
  int i;
  for (i = 0; i < 3; i++) {
    b[i] = (char *)malloc(10 * sizeof *b);
  }
  printf("%d\n", sizeof b);
  printf("%d\n", sizeof *b);
  for (i = 0; i < 3; i++)
    free(b[i]);
  c = (char **)malloc(sizeof(char *) * 3);
  for (i = 0; i < 3; i++)
    c[i] = (char *)malloc(10 * sizeof *c);
  printf("%d\n", sizeof c);
  printf("%d\n", sizeof *c);
  for (i = 0; i < 3; i++)
    free(c[i]);
  free(c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    $0x1e,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xe82(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe6f(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x3,-0x3c(%rbp)
jge    11db <main+0xab>
mov    $0x50,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
movslq -0x3c(%rbp),%rax
mov    %rcx,-0x30(%rbp,%rax,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11ad <main+0x7d>
lea    0xe1e(%rip),%rdi
mov    $0x18,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe0b(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x3,-0x3c(%rbp)
jge    122e <main+0xfe>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
call   1030 <free@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1208 <main+0xd8>
mov    $0x18,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x3,-0x3c(%rbp)
jge    1274 <main+0x144>
mov    $0x50,%edi
call   1050 <malloc@plt>
mov    %rax,%rdx
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1243 <main+0x113>
lea    0xd85(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd72(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x3,-0x3c(%rbp)
jge    12ca <main+0x19a>
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12a1 <main+0x171>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    $0x8,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x8,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xa,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x18,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x8,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x8,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x8,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]*
%3 = alloca i32*
%4 = alloca [3 x i8*]
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %1
%7 = call i8* @malloc(i64 4)
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 8)
%10 = load i32*, i32** %3
%11 = bitcast i32* %10 to i8*
%12 = call i8* @malloc(i64 30)
%13 = bitcast i8* %12 to [10 x i8]*
store [10 x i8]* %13, [10 x i8]** %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 8)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 10)
%16 = load [10 x i8]*, [10 x i8]** %2
%17 = bitcast [10 x i8]* %16 to i8*
store i32 0, i32* %6
br label %18
18: ; preds = %26, %0
%19 = load i32, i32* %6
%20 = icmp slt i32 %19, 3
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = call i8* @malloc(i64 80)
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [3 x i8*], [3 x i8*]* %4, i64 0, i64 %24
store i8* %22, i8** %25
br label %26
26: ; preds = %21
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %18
29: ; preds = %18
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 24)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 8)
store i32 0, i32* %6
br label %32
32: ; preds = %40, %29
%33 = load i32, i32* %6
%34 = icmp slt i32 %33, 3
br i1 %34, label %35, label %43
35: ; preds = %32
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [3 x i8*], [3 x i8*]* %4, i64 0, i64 %37
%39 = load i8*, i8** %38
br label %40
40: ; preds = %35
%41 = load i32, i32* %6
%42 = add nsw i32 %41, 1
store i32 %42, i32* %6
br label %32
43: ; preds = %32
%44 = call i8* @malloc(i64 24)
%45 = bitcast i8* %44 to i8**
store i8** %45, i8*** %5
store i32 0, i32* %6
br label %46
46: ; preds = %55, %43
%47 = load i32, i32* %6
%48 = icmp slt i32 %47, 3
br i1 %48, label %49, label %58
49: ; preds = %46
%50 = call i8* @malloc(i64 80)
%51 = load i8**, i8*** %5
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %51, i64 %53
store i8* %50, i8** %54
br label %55
55: ; preds = %49
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %46
58: ; preds = %46
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 8)
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 8)
store i32 0, i32* %6
br label %61
61: ; preds = %70, %58
%62 = load i32, i32* %6
%63 = icmp slt i32 %62, 3
br i1 %63, label %64, label %73
64: ; preds = %61
%65 = load i8**, i8*** %5
%66 = load i32, i32* %6
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8*, i8** %65, i64 %67
%69 = load i8*, i8** %68
br label %70
70: ; preds = %64
%71 = load i32, i32* %6
%72 = add nsw i32 %71, 1
store i32 %72, i32* %6
br label %61
73: ; preds = %61
%74 = load i8**, i8*** %5
%75 = bitcast i8** %74 to i8*
%76 = load i32, i32* %1
ret i32 %76
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 8)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 8)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 10)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 24)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 8)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 8)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 8)
ret i32 0
}