#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);
void func_2b(int **const i) {
  printf("func_2b : %d >> ", **i);
  {
    int bkup = **i;
    **i = 10;
    printf("%d >> ", **i);
    **i = bkup;
  }
  {
    int *bkup = *i;
    int x = 20;
    int *y = &x;
    *i = y;
    printf("%d\n", **i);
    *i = bkup;
  }
}


x86 assembly (clang, -O0):
<func_2b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movl   $0xa,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
movl   $0x14,-0x1c(%rbp)
lea    -0x1c(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_2b>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    (%rdi),%rax
mov    (%rax),%esi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
mov    (%rbx),%rax
mov    (%rax),%r14d
movl   $0xa,(%rax)
lea    0xecb(%rip),%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
mov    (%rbx),%rbp
mov    %r14d,0x0(%rbp)
movl   $0x14,0xc(%rsp)
lea    0xc(%rsp),%rax
mov    %rax,(%rbx)
lea    0xeaa(%rip),%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
mov    %rbp,(%rbx)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"func_2b : %d >> \00"
@.str.1 = [7 x i8] c"%d >> \00"
@.str.2 = [4 x i8] c"%d\0A\00"
define void @func_2b(i32** nocapture %0) {
%2 = alloca i32
%3 = load i32*, i32** %0
%4 = load i32, i32* %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32*, i32** %0
%7 = load i32, i32* %6
store i32 10, i32* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 10)
%9 = load i32*, i32** %0
store i32 %7, i32* %9
%10 = bitcast i32* %2 to i8*
store i32 20, i32* %2
store i32* %2, i32** %0
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 20)
store i32* %9, i32** %0
ret void
}