#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 nested() {
  int a;
  printf("nested 0: a = %d\n", a);
  a = 50;
  printf("nested 1: a = %d\n", a);
  {
    int a;
    printf("nested 2: a = %d\n", a);
    a = 51;
    printf("nested 3: a = %d\n", a);
  }
  printf("nested 4: a = %d\n", a);
}


x86 assembly (clang, -O0):
<nested>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x8(%rbp),%esi
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
movl   $0x32,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
movl   $0x33,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nested>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x32,%esi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
mov    $0x32,%esi
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0x33,%esi
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x33,%esi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x32,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"nested 0: a = %d\0A\00"
@.str.1 = [18 x i8] c"nested 1: a = %d\0A\00"
@.str.2 = [18 x i8] c"nested 2: a = %d\0A\00"
@.str.3 = [18 x i8] c"nested 3: a = %d\0A\00"
@.str.4 = [18 x i8] c"nested 4: a = %d\0A\00"
define i32 @nested() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 50, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %8)
store i32 51, i32* %3
%10 = load i32, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %2
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [18 x i8] c"nested 0: a = %d\0A\00"
@.str.1 = [18 x i8] c"nested 1: a = %d\0A\00"
@.str.2 = [18 x i8] c"nested 2: a = %d\0A\00"
@.str.3 = [18 x i8] c"nested 3: a = %d\0A\00"
@.str.4 = [18 x i8] c"nested 4: a = %d\0A\00"
define i32 @nested() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 50)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 50)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 51)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 51)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 50)
ret i32 undef
}