#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() {
  int x = 30;
  printf("x in outer block: %d at %p\n", x, &x);
  {
    int x = 77;
    printf("x in inner block: %d at %p\n", x, &x);
  }
  printf("x in outer block: %d at %p\n", x, &x);
  while (x++ < 33) {
    int x = 100;
    x++;
    printf("x in while loop: %d at %p\n", x, &x);
  }
  printf("x in outer block: %d at %p\n", x, &x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1e,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed0(%rip),%rdi
lea    -0x8(%rbp),%rdx
call   1030 <printf@plt>
movl   $0x4d,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xed2(%rip),%rdi
lea    -0xc(%rbp),%rdx
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xea3(%rip),%rdi
lea    -0x8(%rbp),%rdx
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x21,%eax
jge    11a2 <main+0x92>
movl   $0x64,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xea4(%rip),%rdi
lea    -0x10(%rbp),%rdx
call   1030 <printf@plt>
jmp    1166 <main+0x56>
mov    -0x8(%rbp),%esi
lea    0xe54(%rip),%rdi
lea    -0x8(%rbp),%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0x1e,0xc(%rsp)
lea    0xeda(%rip),%rbx
lea    0xc(%rsp),%r14
mov    %rbx,%rdi
mov    $0x1e,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
movl   $0x4d,0x14(%rsp)
lea    0xed2(%rip),%rdi
lea    0x14(%rsp),%rdx
mov    $0x4d,%esi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
lea    0x1(%rax),%esi
mov    %esi,0xc(%rsp)
cmp    $0x20,%eax
jg     11b8 <main+0xa8>
lea    0xeb9(%rip),%r14
lea    0x10(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movl   $0x65,0x10(%rsp)
mov    %r14,%rdi
mov    $0x65,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
lea    0x1(%rax),%esi
mov    %esi,0xc(%rsp)
cmp    $0x21,%eax
jl     1190 <main+0x80>
lea    0xe41(%rip),%rdi
lea    0xc(%rsp),%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"x in outer block: %d at %p\0A\00"
@.str.1 = [28 x i8] c"x in inner block: %d at %p\0A\00"
@.str.2 = [27 x i8] c"x in while loop: %d at %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 30, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %5, i32* %2)
store i32 77, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32* %3)
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %9, i32* %2)
br label %11
11: ; preds = %15, %0
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
%14 = icmp slt i32 %12, 33
br i1 %14, label %15, label %20
15: ; preds = %11
store i32 100, i32* %4
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32* %4)
br label %11
20: ; preds = %11
%21 = load i32, i32* %2
%22 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %21, i32* %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"x in outer block: %d at %p\0A\00"
@.str.1 = [28 x i8] c"x in inner block: %d at %p\0A\00"
@.str.2 = [27 x i8] c"x in while loop: %d at %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 30, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 30, i32* %1)
%6 = bitcast i32* %2 to i8*
store i32 77, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 77, i32* %2)
%8 = load i32, i32* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %8, i32* %1)
%10 = load i32, i32* %1
%11 = add nsw i32 %10, 1
store i32 %11, i32* %1
%12 = icmp slt i32 %10, 33
br i1 %12, label %13, label %20
13: ; preds = %0
%14 = bitcast i32* %3 to i8*
br label %15
15: ; preds = %13, %15
store i32 101, i32* %3
%16 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 101, i32* %3)
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 1
store i32 %18, i32* %1
%19 = icmp slt i32 %17, 33
br i1 %19, label %15, label %20
20: ; preds = %15, %0
%21 = phi i32 [ %11, %0 ], [ %18, %15 ]
%22 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %21, i32* %1)
ret i32 0
}