#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*/ f();
int /*<<< orphan*/ printf(char *, int, int, ...);
main() {
  f();
  for (int i = 0, j = 2; i < 5; i++) {
    printf("i = %d, j = %d\n", i, j);
    j += i;
  }
  for (int i = 42, j = 84;;) {
    printf("i = %d 42, j = %d 84\n", i, j);
    break;
  }
  for (int i = 1, j, k = 2;;) {
    printf("1 = %d, ? = %d, 2 = %d\n", i, j, k);
    break;
  }
  for (int i = 1, j = 2, k = 3;;)
    return i + j + k;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <f@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1179 <main+0x59>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <main+0x24>
movl   $0x2a,-0x10(%rbp)
movl   $0x54,-0x14(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x18(%rbp)
movl   $0x2,-0x20(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x24(%rbp)
movl   $0x2,-0x28(%rbp)
movl   $0x3,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
add    -0x28(%rbp),%eax
add    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <f@plt>
lea    0xed1(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x5,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x8,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe79(%rip),%rdi
mov    $0x2a,%esi
mov    $0x54,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe77(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x6,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"i = %d, j = %d\0A\00"
@.str.1 = [22 x i8] c"i = %d 42, j = %d 84\0A\00"
@.str.2 = [24 x i8] c"1 = %d, ? = %d, 2 = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = call i32 (...) @f()
store i32 0, i32* %2
store i32 2, i32* %3
br label %13
13: ; preds = %23, %0
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 5
br i1 %15, label %16, label %26
16: ; preds = %13
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = add nsw i32 %21, %20
store i32 %22, i32* %3
br label %23
23: ; preds = %16
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %13
26: ; preds = %13
store i32 42, i32* %4
store i32 84, i32* %5
br label %27
27: ; preds = %26
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %29)
br label %31
31: ; preds = %27
store i32 1, i32* %6
store i32 2, i32* %8
br label %32
32: ; preds = %31
%33 = load i32, i32* %6
%34 = load i32, i32* %7
%35 = load i32, i32* %8
%36 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 %34, i32 %35)
br label %37
37: ; preds = %32
store i32 1, i32* %9
store i32 2, i32* %10
store i32 3, i32* %11
br label %38
38: ; preds = %37
%39 = load i32, i32* %9
%40 = load i32, i32* %10
%41 = add nsw i32 %39, %40
%42 = load i32, i32* %11
%43 = add nsw i32 %41, %42
ret i32 %43
}

LLVM IR (-O2):
@.str = [16 x i8] c"i = %d, j = %d\0A\00"
@.str.1 = [22 x i8] c"i = %d 42, j = %d 84\0A\00"
@.str.2 = [24 x i8] c"1 = %d, ? = %d, 2 = %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0, i32 2)
%3 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1, i32 2)
%4 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 2, i32 3)
%5 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 3, i32 5)
%6 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 4, i32 8)
%7 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 42, i32 84)
%8 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 undef, i32 2)
ret i32 6
}