#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 getpid();
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int a1 = 10;
  int a2 = 20;
  int a3 = 30;
  int *p1 = (int *)malloc(sizeof(int));
  int *p2 = (int *)malloc(sizeof(int));
  int *p3 = (int *)malloc(sizeof(int));
  int *p4 = (int *)malloc(4);
  printf("a1 = %p\n", &a1);
  printf("a2 = %p\n", &a2);
  printf("a3 = %p\n", &a3);
  printf("p1 = %p\n", p1);
  printf("p2 = %p\n", p2);
  printf("p3 = %p\n", p3);
  printf("p4 = %p\n", p4);
  printf("%d\n", getpid());
  while (1)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
movl   $0x1e,-0x10(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
lea    0xe6d(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe64(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5b(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1221 <main+0xf1>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0xa,0x14(%rsp)
movl   $0x14,0x10(%rsp)
movl   $0x1e,0xc(%rsp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%r12
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
lea    0xe72(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe68(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe5e(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe54(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe4c(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe44(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe3c(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xe2d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
nopl   0x0(%rax,%rax,1)
jmp    1220 <main+0xf0>

LLVM IR (-O0):
@.str = [9 x i8] c"a1 = %p\0A\00"
@.str.1 = [9 x i8] c"a2 = %p\0A\00"
@.str.2 = [9 x i8] c"a3 = %p\0A\00"
@.str.3 = [9 x i8] c"p1 = %p\0A\00"
@.str.4 = [9 x i8] c"p2 = %p\0A\00"
@.str.5 = [9 x i8] c"p3 = %p\0A\00"
@.str.6 = [9 x i8] c"p4 = %p\0A\00"
@.str.7 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32 0, i32* %1
store i32 10, i32* %2
store i32 20, i32* %3
store i32 30, i32* %4
%9 = call i64 @malloc(i32 4)
%10 = inttoptr i64 %9 to i32*
store i32* %10, i32** %5
%11 = call i64 @malloc(i32 4)
%12 = inttoptr i64 %11 to i32*
store i32* %12, i32** %6
%13 = call i64 @malloc(i32 4)
%14 = inttoptr i64 %13 to i32*
store i32* %14, i32** %7
%15 = call i64 @malloc(i32 4)
%16 = inttoptr i64 %15 to i32*
store i32* %16, i32** %8
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%20 = load i32*, i32** %5
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %20)
%22 = load i32*, i32** %6
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32* %22)
%24 = load i32*, i32** %7
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %24)
%26 = load i32*, i32** %8
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32* %26)
%28 = call i32 (...) @getpid()
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %0, %30
br label %30
}

LLVM IR (-O2):
@.str = [9 x i8] c"a1 = %p\0A\00"
@.str.1 = [9 x i8] c"a2 = %p\0A\00"
@.str.2 = [9 x i8] c"a3 = %p\0A\00"
@.str.3 = [9 x i8] c"p1 = %p\0A\00"
@.str.4 = [9 x i8] c"p2 = %p\0A\00"
@.str.5 = [9 x i8] c"p3 = %p\0A\00"
@.str.6 = [9 x i8] c"p4 = %p\0A\00"
@.str.7 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 20, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 30, i32* %3
%7 = tail call i64 @malloc(i32 4)
%8 = inttoptr i64 %7 to i32*
%9 = tail call i64 @malloc(i32 4)
%10 = inttoptr i64 %9 to i32*
%11 = tail call i64 @malloc(i32 4)
%12 = inttoptr i64 %11 to i32*
%13 = tail call i64 @malloc(i32 4)
%14 = inttoptr i64 %13 to i32*
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %8)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32* %10)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %12)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32* %14)
%22 = call i32 (...) @getpid()
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %24, %0
br label %24
}