#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 f1(void) {
  int a = 1;
  int i = 0;
  static int b = 5;
  printf("---in f1 a = %d;\n", a);
  for (i = 0; i < 3; i++) {
    printf("in f1 b = %d; i = %d;\n", b, i);
    b++;
  };
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    117c <f1+0x6c>
mov    0x2eda(%rip),%esi
mov    -0x8(%rbp),%edx
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2ec3(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eba(%rip)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113e <f1+0x2e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %rbx
lea    0xee8(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2efe(%rip),%esi
lea    0xee1(%rip),%rbx
mov    %rbx,%rdi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2ee5(%rip),%esi
add    $0x1,%esi
mov    %esi,0x2edc(%rip)
mov    %rbx,%rdi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2ec7(%rip),%esi
add    $0x1,%esi
mov    %esi,0x2ebe(%rip)
mov    %rbx,%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <printf@plt>
addl   $0x1,0x2ea8(%rip)
pop    %rbx
ret

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

LLVM IR (-O2):
@f1.b = internal unnamed_addr global i32 5
@.str = [18 x i8] c"---in f1 a = %d;\0A\00"
@.str.1 = [23 x i8] c"in f1 b = %d; i = %d;\0A\00"
define void @f1() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = load i32, i32* @f1.b
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 0)
%4 = load i32, i32* @f1.b
%5 = add nsw i32 %4, 1
store i32 %5, i32* @f1.b
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 1)
%7 = load i32, i32* @f1.b
%8 = add nsw i32 %7, 1
store i32 %8, i32* @f1.b
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 2)
%10 = load i32, i32* @f1.b
%11 = add nsw i32 %10, 1
store i32 %11, i32* @f1.b
ret void
}