#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*/ ch(int *);
int /*<<< orphan*/ cha(char *);
int /*<<< orphan*/ chan(int, int);
int /*<<< orphan*/ change(int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int a = 10, b = 20;
  int *p = &a, *q = &b;
  chan(a, b);
  printf("%d\n", *p);
  printf("%d\n", *q);
  change(&a, &b);
  printf("%d\n", *p);
  printf("%d\n", *q);
  int arr[2] = {0, 20};
  ch(arr);
  printf("%d %d\n", arr[0], arr[1]);
  char str[] = "loaded";
  cha(str);
  printf("%s", str);
  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)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <chan@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <change@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0xe28(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
call   1060 <ch@plt>
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0xdf4(%rip),%eax
mov    %eax,-0x2f(%rbp)
mov    0xdee(%rip),%ax
mov    %ax,-0x2b(%rbp)
mov    0xde6(%rip),%al
mov    %al,-0x29(%rbp)
lea    -0x2f(%rbp),%rdi
call   1030 <cha@plt>
lea    -0x2f(%rbp),%rsi
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movl   $0xa,0xc(%rsp)
movl   $0x14,0x8(%rsp)
mov    $0xa,%edi
mov    $0x14,%esi
call   1050 <chan@plt>
lea    0xe88(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <change@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movabs $0x1400000000,%rax
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rdi
call   1060 <ch@plt>
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%edx
lea    0xe14(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movl   $0x646564,0x1b(%rsp)
movl   $0x64616f6c,0x18(%rsp)
64
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <cha@plt>
lea    0xdf7(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@__const.main.arr = [2 x i32] [i32 0, i32 20]
@.str.1 = [7 x i8] c"%d %d\0A\00"
@__const.main.str = [7 x i8] c"loaded\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca [2 x i32]
%7 = alloca [7 x i8]
store i32 0, i32* %1
store i32 10, i32* %2
store i32 20, i32* %3
store i32* %2, i32** %4
store i32* %3, i32** %5
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @chan(i32 %8, i32 %9)
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32*, i32** %5
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 @change(i32* %2, i32* %3)
%18 = load i32*, i32** %4
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i32*, i32** %5
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = bitcast [2 x i32]* %6 to i8*
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%26 = call i32 @ch(i32* %25)
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%28 = load i32, i32* %27
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %30)
%32 = bitcast [7 x i8]* %7 to i8*
%33 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%34 = call i32 @cha(i8* %33)
%35 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [7 x i8] c"%d %d\0A\00"
@__const.main.str = [7 x i8] c"loaded\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = bitcast i64* %3 to [2 x i32]*
%5 = alloca [7 x i8]
%6 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%7 = bitcast i32* %2 to i8*
store i32 20, i32* %2
%8 = tail call i32 @chan(i32 10, i32 20)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 10)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 20)
%11 = call i32 @change(i32* %1, i32* %2)
%12 = load i32, i32* %1
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = bitcast i64* %3 to i8*
store i64 85899345920, i64* %3
%17 = bitcast i64* %3 to i32*
%18 = call i32 @ch(i32* %17)
%19 = load i32, i32* %17
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %21)
%23 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%24 = call i32 @cha(i8* %23)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %23)
ret i32 0
}