#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 main(void) {
  int num1 = 10, num2 = 20;
  int *ptr1, *ptr2;
  int *temp;
  printf("1.\tnum1 =%d, num2 = %d\n", num1, num2);
  ptr1 = &num1;
  ptr2 = &num2;
  printf("2.\t*ptr1 =%d, *ptr2 = %d\n", *ptr1, *ptr2);
  *ptr1 += 10;
  *ptr2 -= 10;
  printf("3.\tnum1 =%d, num2 = %d\n", num1, num2);
  temp = ptr1;
  ptr1 = ptr2;
  ptr2 = temp;
  printf("4.\t*ptr1 =%d, *ptr2 = %d\n", *ptr1, *ptr2);
  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)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0xa,%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
sub    $0xa,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
mov    $0x14,%esi
mov    $0xa,%edx
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"1.\09num1 =%d, num2 = %d\0A\00"
@.str.1 = [26 x i8] c"2.\09*ptr1 =%d, *ptr2 = %d\0A\00"
@.str.2 = [24 x i8] c"3.\09num1 =%d, num2 = %d\0A\00"
@.str.3 = [26 x i8] c"4.\09*ptr1 =%d, *ptr2 = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32 0, i32* %1
store i32 10, i32* %2
store i32 20, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
store i32* %2, i32** %4
store i32* %3, i32** %5
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %13)
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 10
store i32 %17, i32* %15
%18 = load i32*, i32** %5
%19 = load i32, i32* %18
%20 = sub nsw i32 %19, 10
store i32 %20, i32* %18
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %22)
%24 = load i32*, i32** %4
store i32* %24, i32** %6
%25 = load i32*, i32** %5
store i32* %25, i32** %4
%26 = load i32*, i32** %6
store i32* %26, i32** %5
%27 = load i32*, i32** %4
%28 = load i32, i32* %27
%29 = load i32*, i32** %5
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %28, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"1.\09num1 =%d, num2 = %d\0A\00"
@.str.1 = [26 x i8] c"2.\09*ptr1 =%d, *ptr2 = %d\0A\00"
@.str.2 = [24 x i8] c"3.\09num1 =%d, num2 = %d\0A\00"
@.str.3 = [26 x i8] c"4.\09*ptr1 =%d, *ptr2 = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 10, i32 20)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 20)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 20, i32 10)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 10, i32 20)
ret i32 0
}