#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*/ foo(int, long *, long *);
int /*<<< orphan*/ printf(char *, long, ...);
int main(int argc, char **argv) {
  long p = 1;
  long q = 1;
  long s = 1;
  foo(10, &q, &q);
  printf("q=%li\n", q);
  foo(12, &p, &s);
  printf("p=%li s=%li\n", p, s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
movq   $0x1,-0x28(%rbp)
mov    $0xa,%edi
lea    -0x20(%rbp),%rdx
mov    %rdx,%rsi
call   1040 <foo@plt>
mov    -0x20(%rbp),%rsi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xc,%edi
lea    -0x18(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <foo@plt>
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movq   $0x1,0x10(%rsp)
movq   $0x1,0x8(%rsp)
movq   $0x1,(%rsp)
lea    0x8(%rsp),%rdx
mov    $0xa,%edi
mov    %rdx,%rsi
call   1040 <foo@plt>
mov    0x8(%rsp),%rsi
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rsp,%rdx
mov    $0xc,%edi
call   1040 <foo@plt>
mov    0x10(%rsp),%rsi
mov    (%rsp),%rdx
lea    0xe82(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"q=%li\0A\00"
@.str.1 = [13 x i8] c"p=%li s=%li\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 1, i64* %6
store i64 1, i64* %7
store i64 1, i64* %8
%9 = call i32 @foo(i32 10, i64* %7, i64* %7)
%10 = load i64, i64* %7
%11 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = call i32 @foo(i32 12, i64* %6, i64* %8)
%13 = load i64, i64* %6
%14 = load i64, i64* %8
%15 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 %13, i64 %14)
ret i32 0
}

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