#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*/ printf(char *, int, int, int);
int main() {
  int a, b;
  int *p;
  a = 10, b = 20;
  p = &a;
  *p = 40;
  printf("a=%d,b=%d,*p=%d\n", a, b, *p);
  *p = b;
  printf("a=%d,b=%d,*p=%d\n", a, b, *p);
  p = &b;
  *p = 60;
  printf("a=%d,b=%d,*p=%d\n", a, b, *p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x28,(%rax)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x3c,(%rax)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x28,%esi
mov    $0x14,%edx
mov    $0x28,%ecx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
mov    $0x14,%edx
mov    $0x14,%ecx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
mov    $0x3c,%edx
mov    $0x3c,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"a=%d,b=%d,*p=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 0, i32* %1
store i32 10, i32* %2
store i32 20, i32* %3
store i32* %2, i32** %4
%5 = load i32*, i32** %4
store i32 40, i32* %5
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7, i32 %9)
%11 = load i32, i32* %3
%12 = load i32*, i32** %4
store i32 %11, i32* %12
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14, i32 %16)
store i32* %3, i32** %4
%18 = load i32*, i32** %4
store i32 60, i32* %18
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = load i32*, i32** %4
%22 = load i32, i32* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20, i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"a=%d,b=%d,*p=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 40, i32 20, i32 40)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 20, i32 20, i32 20)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 20, i32 60, i32 60)
ret i32 0
}