#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 *, ...);
void main() {
  int i = 0;
  int tmp = 0;
  int pre = 0;
  int post = 0;
  int pre_arr[4];
  int post_arr[4];
  for (i = 0; i < 4; ++i) {
    pre = 0;
    post = 0;
  };
  for (i = 0; i < 3; ++i) {
    pre = i;
    printf("pre at step %d = %d;\n", i, pre);
  };
  printf("\n");
  for (i = 0; i < 3; i++) {
    post = i;
    printf("post at step %d = %d;\n", i, post);
  };
  printf("\n");
  i = 0;
  tmp = 0;
  do {
    tmp += 1;
    pre_arr[++i] = tmp;
    printf("tmp = %d; pre_arr [ i = %d ] = %d;\n", tmp, i, pre_arr[i]);
  } while (i < 3);
  printf("\n");
  i = 0;
  tmp = 0;
  do {
    tmp += 1;
    post_arr[i++] = tmp;
    printf(
        "tmp = %d; post_arr [ i = %d ] = %8d;post_arr [ i - 1 = %d ] = %2d;\n",
        tmp, i, post_arr[i], (i - 1), post_arr[i - 1]);
  } while (i < 3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    1161 <main+0x51>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113b <main+0x2b>
movl   $0x0,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
jge    119a <main+0x8a>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1168 <main+0x58>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
jge    11e1 <main+0xd1>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11af <main+0x9f>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cltq
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
movslq -0x4(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x4(%rbp)
jl     11fd <main+0xed>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x4(%rbp)
cltq
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
movslq -0x4(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
mov    -0x4(%rbp),%r8d
sub    $0x1,%r8d
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%r9d
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x4(%rbp)
jl     125a <main+0x14a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xea7(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe77(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
mov    $0x3,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe3f(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x1,%r8d
mov    $0x2,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
mov    $0x2,%r8d
mov    $0x3,%r9d
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"pre at step %d = %d;\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [23 x i8] c"post at step %d = %d;\0A\00"
@.str.3 = [36 x i8] c"tmp = %d; pre_arr [ i = %d ] = %d;\0A\00"
@.str.4 = [68 x i8] c"tmp = %d; post_arr [ i = %d ] = %8d;post_arr [ i - 1 = %d ] = %2d;\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [4 x i32]
%6 = alloca [4 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %1
br label %7
7: ; preds = %11, %0
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %14
10: ; preds = %7
store i32 0, i32* %3
store i32 0, i32* %4
br label %11
11: ; preds = %10
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 1
store i32 %13, i32* %1
br label %7
14: ; preds = %7
store i32 0, i32* %1
br label %15
15: ; preds = %23, %14
%16 = load i32, i32* %1
%17 = icmp slt i32 %16, 3
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load i32, i32* %1
store i32 %19, i32* %3
%20 = load i32, i32* %1
%21 = load i32, i32* %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21)
br label %23
23: ; preds = %18
%24 = load i32, i32* %1
%25 = add nsw i32 %24, 1
store i32 %25, i32* %1
br label %15
26: ; preds = %15
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %28
28: ; preds = %36, %26
%29 = load i32, i32* %1
%30 = icmp slt i32 %29, 3
br i1 %30, label %31, label %39
31: ; preds = %28
%32 = load i32, i32* %1
store i32 %32, i32* %4
%33 = load i32, i32* %1
%34 = load i32, i32* %4
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 %34)
br label %36
36: ; preds = %31
%37 = load i32, i32* %1
%38 = add nsw i32 %37, 1
store i32 %38, i32* %1
br label %28
39: ; preds = %28
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
store i32 0, i32* %2
br label %41
41: ; preds = %56, %39
%42 = load i32, i32* %2
%43 = add nsw i32 %42, 1
store i32 %43, i32* %2
%44 = load i32, i32* %2
%45 = load i32, i32* %1
%46 = add nsw i32 %45, 1
store i32 %46, i32* %1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %47
store i32 %44, i32* %48
%49 = load i32, i32* %2
%50 = load i32, i32* %1
%51 = load i32, i32* %1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %49, i32 %50, i32 %54)
br label %56
56: ; preds = %41
%57 = load i32, i32* %1
%58 = icmp slt i32 %57, 3
br i1 %58, label %41, label %59
59: ; preds = %56
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
store i32 0, i32* %2
br label %61
61: ; preds = %83, %59
%62 = load i32, i32* %2
%63 = add nsw i32 %62, 1
store i32 %63, i32* %2
%64 = load i32, i32* %2
%65 = load i32, i32* %1
%66 = add nsw i32 %65, 1
store i32 %66, i32* %1
%67 = sext i32 %65 to i64
%68 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 %67
store i32 %64, i32* %68
%69 = load i32, i32* %2
%70 = load i32, i32* %1
%71 = load i32, i32* %1
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 %72
%74 = load i32, i32* %73
%75 = load i32, i32* %1
%76 = sub nsw i32 %75, 1
%77 = load i32, i32* %1
%78 = sub nsw i32 %77, 1
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 %79
%81 = load i32, i32* %80
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0), i32 %69, i32 %70, i32 %74, i32 %76, i32 %81)
br label %83
83: ; preds = %61
%84 = load i32, i32* %1
%85 = icmp slt i32 %84, 3
br i1 %85, label %61, label %86
86: ; preds = %83
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"pre at step %d = %d;\0A\00"
@.str.2 = [23 x i8] c"post at step %d = %d;\0A\00"
@.str.3 = [36 x i8] c"tmp = %d; pre_arr [ i = %d ] = %d;\0A\00"
@.str.4 = [68 x i8] c"tmp = %d; post_arr [ i = %d ] = %8d;post_arr [ i - 1 = %d ] = %2d;\0A\00"
define void @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 1, i32 1)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 2, i32 2)
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 0)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 1)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 2)
%8 = tail call i32 @putchar(i32 10)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 1, i32 1)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 2, i32 2, i32 2)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 3, i32 3, i32 3)
%12 = tail call i32 @putchar(i32 10)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0), i32 1, i32 1, i32 2, i32 0, i32 1)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0), i32 2, i32 2, i32 3, i32 1, i32 2)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0), i32 3, i32 3, i32 undef, i32 2, i32 3)
ret void
}