#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 *f1(int *, int *);
int *f2(int **, int **);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int a, b, c;
  int *pa, *pb, *pc, *pd;
  a = 1;
  b = 2;
  c = 3;
  pa = &a;
  pb = &b;
  pc = f1(pa, pb);
  printf("%d %d\n", *pc, *pa);
  pd = f2(&pa, &pb);
  printf("%d %d\n", *pd, *pa);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <f1@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe78(%rip),%rdi
call   1040 <printf@plt>
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <f2@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe4f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movl   $0x1,0x8(%rsp)
movl   $0x2,0xc(%rsp)
lea    0x8(%rsp),%rdi
mov    %rdi,0x10(%rsp)
lea    0xc(%rsp),%rsi
mov    %rsi,0x18(%rsp)
call   1050 <f1@plt>
mov    (%rax),%esi
mov    0x8(%rsp),%edx
lea    0xe95(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rsi
call   1030 <f2@plt>
mov    (%rax),%esi
mov    0x10(%rsp),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %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 1, i32* %2
store i32 2, i32* %3
store i32 3, i32* %4
store i32* %2, i32** %5
store i32* %3, i32** %6
%9 = load i32*, i32** %5
%10 = load i32*, i32** %6
%11 = call i32* @f1(i32* %9, i32* %10)
store i32* %11, i32** %7
%12 = load i32*, i32** %7
%13 = load i32, i32* %12
%14 = load i32*, i32** %5
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %15)
%17 = call i32* @f2(i32** %5, i32** %6)
store i32* %17, i32** %8
%18 = load i32*, i32** %8
%19 = load i32, i32* %18
%20 = load i32*, i32** %5
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32** %3 to i8*
%8 = bitcast i32** %4 to i8*
store i32 1, i32* %1
store i32 2, i32* %2
store i32* %1, i32** %3
store i32* %2, i32** %4
%9 = call i32* @f1(i32* %1, i32* %2)
%10 = load i32, i32* %9
%11 = load i32, i32* %1
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11)
%13 = call i32* @f2(i32** %3, i32** %4)
%14 = load i32, i32* %13
%15 = load i32*, i32** %3
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16)
ret i32 0
}