#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 EXIT_SUCCESS;
int /*<<< orphan*/ free(int *);
int *malloc(int);
int /*<<< orphan*/ mallocMadness(double);
int /*<<< orphan*/ manualArray();
int /*<<< orphan*/ printSomeCharAddresses(int *);
int /*<<< orphan*/ printf(char *, int, ...);
int rand();
int /*<<< orphan*/ srand(int);
int main(int argc, char *argv[]) {
  int favNumber = 5;
  int *favNumberLocation = &favNumber;
  printf("Value of favNumber: %d, Location of favNumber: %p\n", favNumber,
         favNumberLocation);
  srand(225);
  int randomNumber = rand() % 20;
  int *randomNumberLocation = &randomNumber;
  printf("Value of randomNumber: %d, Location of randomNumber: %p\n",
         randomNumber, randomNumberLocation);
  int *mallocNumber = malloc(sizeof(int));
  printf("Value of mallocNumber: %d, Location of mallocNumber: %p\n",
         *mallocNumber, mallocNumber);
  free(mallocNumber);
  printf("Size of an int: %d\n", (int)sizeof(int));
  printf("Difference between int pointers: %d\n\n",
         (int)randomNumberLocation - (int)favNumberLocation);
  printSomeCharAddresses(randomNumberLocation);
  mallocMadness(3.141592);
  manualArray();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xe1,%edi
call   1060 <srand@plt>
mov    $0x0,%al
call   10a0 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
lea    -0x24(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x30(%rbp),%rdx
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x4,%edi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
mov    -0x38(%rbp),%rdx
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
lea    0xe84(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%rax
mov    %eax,%esi
mov    -0x20(%rbp),%rax
sub    %eax,%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1080 <printSomeCharAddresses@plt>
movsd  0xda0(%rip),%xmm0
call   1040 <mallocMadness@plt>
mov    $0x0,%al
call   1090 <manualArray@plt>
mov    0x2d6d(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x5,0xc(%rsp)
lea    0xe70(%rip),%rdi
lea    0xc(%rsp),%r14
mov    $0x5,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xe1,%edi
call   1060 <srand@plt>
xor    %eax,%eax
call   10a0 <rand@plt>
movslq %eax,%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
shl    $0x2,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    %esi,0x8(%rsp)
lea    0xe54(%rip),%rdi
lea    0x8(%rsp),%r15
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x4,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    (%rax),%esi
lea    0xe68(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe88(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15d,%esi
sub    %r14d,%esi
lea    0xe83(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1080 <printSomeCharAddresses@plt>
movsd  0xdab(%rip),%xmm0
call   1040 <mallocMadness@plt>
xor    %eax,%eax
call   1090 <manualArray@plt>
mov    0x2d78(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Value of favNumber: %d, Location of favNumber: %p\0A\00"
@.str.1 = [57 x i8] c"Value of randomNumber: %d, Location of randomNumber: %p\0A\00"
@.str.2 = [57 x i8] c"Value of mallocNumber: %d, Location of mallocNumber: %p\0A\00"
@.str.3 = [20 x i8] c"Size of an int: %d\0A\00"
@.str.4 = [38 x i8] c"Difference between int pointers: %d\0A\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 5, i32* %6
store i32* %6, i32** %7
%11 = load i32, i32* %6
%12 = load i32*, i32** %7
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %11, i32* %12)
%14 = call i32 @srand(i32 225)
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 20
store i32 %16, i32* %8
store i32* %8, i32** %9
%17 = load i32, i32* %8
%18 = load i32*, i32** %9
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32* %18)
%20 = call i32* @malloc(i32 4)
store i32* %20, i32** %10
%21 = load i32*, i32** %10
%22 = load i32, i32* %21
%23 = load i32*, i32** %10
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32* %23)
%25 = load i32*, i32** %10
%26 = call i32 @free(i32* %25)
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 4)
%28 = load i32*, i32** %9
%29 = ptrtoint i32* %28 to i32
%30 = load i32*, i32** %7
%31 = ptrtoint i32* %30 to i32
%32 = sub nsw i32 %29, %31
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %32)
%34 = load i32*, i32** %9
%35 = call i32 @printSomeCharAddresses(i32* %34)
%36 = call i32 @mallocMadness(double 0x400921FAFC8B007A)
%37 = call i32 (...) @manualArray()
%38 = load i32, i32* @EXIT_SUCCESS
ret i32 %38
}

LLVM IR (-O2):
@.str = [51 x i8] c"Value of favNumber: %d, Location of favNumber: %p\0A\00"
@.str.1 = [57 x i8] c"Value of randomNumber: %d, Location of randomNumber: %p\0A\00"
@.str.2 = [57 x i8] c"Value of mallocNumber: %d, Location of mallocNumber: %p\0A\00"
@.str.3 = [20 x i8] c"Size of an int: %d\0A\00"
@.str.4 = [38 x i8] c"Difference between int pointers: %d\0A\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 5, i32* %3
%6 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 5, i32* %3)
%7 = call i32 @srand(i32 225)
%8 = bitcast i32* %4 to i8*
%9 = call i32 (...) @rand()
%10 = srem i32 %9, 20
store i32 %10, i32* %4
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32* %4)
%12 = call i32* @malloc(i32 4)
%13 = load i32, i32* %12
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32* %12)
%15 = call i32 @free(i32* %12)
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 4)
%17 = ptrtoint i32* %4 to i64
%18 = trunc i64 %17 to i32
%19 = ptrtoint i32* %3 to i64
%20 = trunc i64 %19 to i32
%21 = sub nsw i32 %18, %20
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = call i32 @printSomeCharAddresses(i32* %4)
%24 = call i32 @mallocMadness(double 0x400921FAFC8B007A)
%25 = call i32 (...) @manualArray()
%26 = load i32, i32* @EXIT_SUCCESS
ret i32 %26
}