#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*/ f(int *, int *, int *);
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int val1 = 100;
  int val2 = 200;
  f(&val1, &val2, &val1);
  printf("Result: %d, %d\n", val1, val2);
  val1 = 50;
  val2 = 75;
  f(&val1, &val2, &val1);
  printf("Result: %d, %d\n", val1, val2);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
movl   $0xc8,-0xc(%rbp)
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rsi
mov    %rdx,%rdi
call   1030 <f@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
movl   $0x32,-0x8(%rbp)
movl   $0x4b,-0xc(%rbp)
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rsi
mov    %rdx,%rdi
call   1030 <f@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x64,0xc(%rsp)
movl   $0xc8,0x8(%rsp)
lea    0x8(%rsp),%r14
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <f@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xea0(%rip),%r15
mov    %r15,%rdi
call   1040 <printf@plt>
movl   $0x32,0xc(%rsp)
movl   $0x4b,0x8(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <f@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %r15,%rdi
call   1040 <printf@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Result: %d, %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 100, i32* %2
store i32 200, i32* %3
%4 = call i32 @f(i32* %2, i32* %3, i32* %2)
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
store i32 50, i32* %2
store i32 75, i32* %3
%8 = call i32 @f(i32* %2, i32* %3, i32* %2)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10)
%12 = load i32, i32* @EXIT_SUCCESS
ret i32 %12
}

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