#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 n = 8;
  printf("	Initially, n = %d at %p\n", n, &n);
  for (int n = 1; n < 3; n++) {
    printf("	loop 1: n = %d at %p\n", n, &n);
  }
  printf("After loop 1, n = %d at %p\n", n, &n);
  for (int n = 1; n < 3; n++) {
    printf("	loop 2 index n = %d at %p\n", n, &n);
    int n = 6;
    printf("	loop 2: n = %d at %p\n", n, &n);
    n++;
  }
  printf("After loop 2, n = %d at %p\n", n, &n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x8,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed0(%rip),%rdi
lea    -0x8(%rbp),%rdx
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    116b <main+0x5b>
mov    -0xc(%rbp),%esi
lea    0xec6(%rip),%rdi
lea    -0xc(%rbp),%rdx
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1140 <main+0x30>
mov    -0x8(%rbp),%esi
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rdx
call   1030 <printf@plt>
movl   $0x1,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    11d3 <main+0xc3>
mov    -0x10(%rbp),%esi
lea    0xeb4(%rip),%rdi
lea    -0x10(%rbp),%rdx
call   1030 <printf@plt>
movl   $0x6,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeb6(%rip),%rdi
lea    -0x14(%rbp),%rdx
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1185 <main+0x75>
mov    -0x8(%rbp),%esi
lea    0xea3(%rip),%rdi
lea    -0x8(%rbp),%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x8,0x10(%rsp)
lea    0xed6(%rip),%rdi
lea    0x10(%rsp),%rdx
mov    $0x8,%esi
call   1030 <printf@plt>
movl   $0x1,0xc(%rsp)
mov    $0x1,%esi
lea    0xecd(%rip),%r14
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
lea    0x1(%rax),%esi
mov    %esi,0xc(%rsp)
cmp    $0x2,%eax
jl     1160 <main+0x50>
mov    0x10(%rsp),%esi
lea    0xeab(%rip),%rdi
lea    0x10(%rsp),%rdx
call   1030 <printf@plt>
movl   $0x1,0xc(%rsp)
mov    $0x1,%esi
lea    0xea9(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xeb9(%rip),%r12
lea    0x14(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r15,%rdx
call   1030 <printf@plt>
movl   $0x6,0x14(%rsp)
mov    %r12,%rdi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
lea    0x1(%rax),%esi
mov    %esi,0xc(%rsp)
cmp    $0x2,%eax
jl     11c0 <main+0xb0>
mov    0x10(%rsp),%esi
lea    0xe82(%rip),%rdi
lea    0x10(%rsp),%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\09Initially, n = %d at %p\0A\00"
@.str.1 = [23 x i8] c"\09loop 1: n = %d at %p\0A\00"
@.str.2 = [28 x i8] c"After loop 1, n = %d at %p\0A\00"
@.str.3 = [28 x i8] c"\09loop 2 index n = %d at %p\0A\00"
@.str.4 = [23 x i8] c"\09loop 2: n = %d at %p\0A\00"
@.str.5 = [28 x i8] c"After loop 2, n = %d at %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 8, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %6, i32* %2)
store i32 1, i32* %3
br label %8
8: ; preds = %14, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = load i32, i32* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32* %3)
br label %14
14: ; preds = %11
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %8
17: ; preds = %8
%18 = load i32, i32* %2
%19 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32* %2)
store i32 1, i32* %4
br label %20
20: ; preds = %30, %17
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 3
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load i32, i32* %4
%25 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %24, i32* %4)
store i32 6, i32* %5
%26 = load i32, i32* %5
%27 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %26, i32* %5)
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %30
30: ; preds = %23
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %20
33: ; preds = %20
%34 = load i32, i32* %2
%35 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %34, i32* %2)
ret i32 0
}

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