#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 foofunc() {
  int i;
  static int a = 10, b = 20;
  for (i = 0; i < 5; i++) {
    static int a = 4424;
    a++;
    printf("%d\n", a);
  }
  b--;
  printf("%d\n", a++);
  printf("%d\n", b);
}


x86 assembly (clang, -O0):
<foofunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    1158 <foofunc+0x48>
mov    0x2f01(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ef8(%rip)
mov    0x2ef2(%rip),%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <foofunc+0xf>
mov    0x2ece(%rip),%eax
add    $0xffffffff,%eax
mov    %eax,0x2ec5(%rip)
mov    0x2ebb(%rip),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,0x2eb0(%rip)
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea2(%rip),%esi
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foofunc>:
push   %rbx
mov    0x2f19(%rip),%esi
add    $0x1,%esi
mov    %esi,0x2f10(%rip)
lea    0xed9(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2efb(%rip),%esi
add    $0x1,%esi
mov    %esi,0x2ef2(%rip)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2ee4(%rip),%esi
add    $0x1,%esi
mov    %esi,0x2edb(%rip)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2ecd(%rip),%esi
add    $0x1,%esi
mov    %esi,0x2ec4(%rip)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2eb6(%rip),%esi
add    $0x1,%esi
mov    %esi,0x2ead(%rip)
mov    %rbx,%rdi
call   1030 <printf@plt>
addl   $0xffffffff,0x2e9a(%rip)
mov    0x2e90(%rip),%esi
lea    0x1(%rsi),%eax
mov    %eax,0x2e87(%rip)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2e7d(%rip),%esi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@foofunc.a = internal unnamed_addr global i32 10
@foofunc.b = internal unnamed_addr global i32 20
@foofunc.a.1 = internal unnamed_addr global i32 4424
@.str = [4 x i8] c"%d\0A\00"
define void @foofunc() {
%1 = load i32, i32* @foofunc.a.1
%2 = add nsw i32 %1, 1
store i32 %2, i32* @foofunc.a.1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @foofunc.a.1
%5 = add nsw i32 %4, 1
store i32 %5, i32* @foofunc.a.1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @foofunc.a.1
%8 = add nsw i32 %7, 1
store i32 %8, i32* @foofunc.a.1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @foofunc.a.1
%11 = add nsw i32 %10, 1
store i32 %11, i32* @foofunc.a.1
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* @foofunc.a.1
%14 = add nsw i32 %13, 1
store i32 %14, i32* @foofunc.a.1
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @foofunc.b
%17 = add nsw i32 %16, -1
store i32 %17, i32* @foofunc.b
%18 = load i32, i32* @foofunc.a
%19 = add nsw i32 %18, 1
store i32 %19, i32* @foofunc.a
%20 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%21 = load i32, i32* @foofunc.b
%22 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
ret void
}