#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*/ array_are_reference_type(int *);
int /*<<< orphan*/ int_are_value_type(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int i = 10;
  int arr[2] = {10, 20};
  printf("\nBefore calling function that manipulates the input:\ni: %i", i);
  int_are_value_type(i);
  printf("\nAfter calling function that manipulates the input:\ni: %i", i);
  printf("\n\nThe fact that the value of i stays same indicates that it is "
         "value type.\n");
  printf("\nBefore calling arr manipulating function:\narr[0], arr[1]: %i, %i",
         arr[0], arr[1]);
  array_are_reference_type(arr);
  printf("\nAfter calling arr manipulating function:\narr[0], arr[1]: %i, %i",
         arr[0], arr[1]);
  printf("\n\nThe fact that the value of arr[0] and arr[1] were swapped "
         "indicates that arr is reference type.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <int_are_value_type@plt>
mov    -0x8(%rbp),%esi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xf33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1040 <array_are_reference_type@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xf58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movabs $0x140000000a,%rax
mov    %rax,(%rsp)
lea    0xeaa(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1060 <int_are_value_type@plt>
lea    0xec8(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf72(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
call   1050 <array_are_reference_type@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xefe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf7c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.arr = [2 x i32] [i32 10, i32 20]
@.str = [59 x i8] c"\0ABefore calling function that manipulates the input:\0Ai: %i\00"
@.str.1 = [58 x i8] c"\0AAfter calling function that manipulates the input:\0Ai: %i\00"
@.str.2 = [76 x i8] c"\0A\0AThe fact that the value of i stays same indicates that it is value type.\0A\00"
@.str.3 = [66 x i8] c"\0ABefore calling arr manipulating function:\0Aarr[0], arr[1]: %i, %i\00"
@.str.4 = [65 x i8] c"\0AAfter calling arr manipulating function:\0Aarr[0], arr[1]: %i, %i\00"
@.str.5 = [99 x i8] c"\0A\0AThe fact that the value of arr[0] and arr[1] were swapped indicates that arr is reference type.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2 x i32]
store i32 0, i32* %1
store i32 10, i32* %2
%4 = bitcast [2 x i32]* %3 to i8*
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
%8 = call i32 @int_are_value_type(i32 %7)
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.2, i64 0, i64 0))
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%13 = load i32, i32* %12
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), i32 %13, i32 %15)
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%18 = call i32 @array_are_reference_type(i32* %17)
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%20 = load i32, i32* %19
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.4, i64 0, i64 0), i32 %20, i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [59 x i8] c"\0ABefore calling function that manipulates the input:\0Ai: %i\00"
@.str.1 = [58 x i8] c"\0AAfter calling function that manipulates the input:\0Ai: %i\00"
@.str.3 = [66 x i8] c"\0ABefore calling arr manipulating function:\0Aarr[0], arr[1]: %i, %i\00"
@.str.4 = [65 x i8] c"\0AAfter calling arr manipulating function:\0Aarr[0], arr[1]: %i, %i\00"
@str = [75 x i8] c"\0A\0AThe fact that the value of i stays same indicates that it is value type.\00"
@str.6 = [98 x i8] c"\0A\0AThe fact that the value of arr[0] and arr[1] were swapped indicates that arr is reference type.\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to [2 x i32]*
%3 = bitcast i64* %1 to i8*
store i64 85899345930, i64* %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 10)
%5 = tail call i32 @int_are_value_type(i32 10)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 10)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str, i64 0, i64 0))
%8 = bitcast i64* %1 to i32*
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), i32 10, i32 20)
%11 = call i32 @array_are_reference_type(i32* %8)
%12 = load i32, i32* %8
%13 = load i32, i32* %9
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.4, i64 0, i64 0), i32 %12, i32 %13)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @str.6, i64 0, i64 0))
ret i32 0
}