#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() {
  int v = 12345;
  int i;
  printf("Value of the block variable v:%d\n", v);
  for (i = 0; i < 5; i++) {
    static int v = 5;
    printf("Value of the block variable v:%d\n", v++);
  }
  printf("Value of the block variable v:%d\n", v);
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3039,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    116a <func+0x5a>
mov    0x2ee3(%rip),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,0x2ed8(%rip)
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1135 <func+0x25>
mov    -0x4(%rbp),%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3039,%esi
call   1030 <printf@plt>
mov    0x2efd(%rip),%esi
lea    0x1(%rsi),%eax
mov    %eax,0x2ef4(%rip)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2ee6(%rip),%esi
lea    0x1(%rsi),%eax
mov    %eax,0x2edd(%rip)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2ecf(%rip),%esi
lea    0x1(%rsi),%eax
mov    %eax,0x2ec6(%rip)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2eb8(%rip),%esi
lea    0x1(%rsi),%eax
mov    %eax,0x2eaf(%rip)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2ea1(%rip),%esi
lea    0x1(%rsi),%eax
mov    %eax,0x2e98(%rip)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3039,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Value of the block variable v:%d\0A\00"
@func.v = internal global i32 5
define void @func() {
%1 = alloca i32
%2 = alloca i32
store i32 12345, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 0, i32* %2
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32, i32* @func.v
%10 = add nsw i32 %9, 1
store i32 %10, i32* @func.v
%11 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %12
12: ; preds = %8
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %5
15: ; preds = %5
%16 = load i32, i32* %1
%17 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %16)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"Value of the block variable v:%d\0A\00"
@func.v = internal unnamed_addr global i32 5
define void @func() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 12345)
%2 = load i32, i32* @func.v
%3 = add nsw i32 %2, 1
store i32 %3, i32* @func.v
%4 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %2)
%5 = load i32, i32* @func.v
%6 = add nsw i32 %5, 1
store i32 %6, i32* @func.v
%7 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %5)
%8 = load i32, i32* @func.v
%9 = add nsw i32 %8, 1
store i32 %9, i32* @func.v
%10 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %8)
%11 = load i32, i32* @func.v
%12 = add nsw i32 %11, 1
store i32 %12, i32* @func.v
%13 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %11)
%14 = load i32, i32* @func.v
%15 = add nsw i32 %14, 1
store i32 %15, i32* @func.v
%16 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %14)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 12345)
ret void
}