#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 GetInt();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int n;
  do {
    printf("Number of people in room: ");
    n = GetInt();
  } while (n < 1);
  int ages[n];
  for (int i = 0; i < n; i++) {
    printf("Age of person #%i: ", i + 1);
    ages[i] = GetInt();
  }
  printf("Time passes...\n");
  for (int i = 0; i < n; i++) {
    printf("A year from now, person #%i will be %i years old.\n", i + 1,
           ages[i] + 1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <GetInt@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     112f <main+0xf>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c1 <main+0xa1>
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <GetInt@plt>
mov    %eax,%edx
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117f <main+0x5f>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1212 <main+0xf2>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%esi
add    $0x1,%esi
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11d6 <main+0xb6>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebb(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <GetInt@plt>
test   %eax,%eax
jle    1150 <main+0x20>
mov    %eax,%r15d
mov    %rsp,%r12
lea    0xf(,%r15,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
lea    0xe97(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rbx),%r13
mov    %r14,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <GetInt@plt>
mov    %eax,(%r12,%rbx,4)
mov    %r13,%rbx
cmp    %r13,%r15
jne    1190 <main+0x60>
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
test   %r15d,%r15d
jle    11ec <main+0xbc>
lea    0xe63(%rip),%r14
xor    %ebx,%ebx
xchg   %ax,%ax
mov    (%r12,%rbx,4),%edx
add    $0x1,%rbx
add    $0x1,%edx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %rbx,%r15
jne    11d0 <main+0xa0>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Number of people in room: \00"
@.str.1 = [20 x i8] c"Age of person #%i: \00"
@.str.2 = [16 x i8] c"Time passes...\0A\00"
@.str.3 = [51 x i8] c"A year from now, person #%i will be %i years old.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
br label %7
7: ; preds = %10, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (...) @GetInt()
store i32 %9, i32* %2
br label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 1
br i1 %12, label %7, label %13
13: ; preds = %10
%14 = load i32, i32* %2
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %3
%17 = alloca i32, i64 %15
store i64 %15, i64* %4
store i32 0, i32* %5
br label %18
18: ; preds = %30, %13
%19 = load i32, i32* %5
%20 = load i32, i32* %2
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %33
22: ; preds = %18
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = call i32 (...) @GetInt()
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %17, i64 %28
store i32 %26, i32* %29
br label %30
30: ; preds = %22
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %18
33: ; preds = %18
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %35
35: ; preds = %48, %33
%36 = load i32, i32* %6
%37 = load i32, i32* %2
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %51
39: ; preds = %35
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %17, i64 %43
%45 = load i32, i32* %44
%46 = add nsw i32 %45, 1
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i32 %41, i32 %46)
br label %48
48: ; preds = %39
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %35
51: ; preds = %35
%52 = load i8*, i8** %3
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
@.str = [27 x i8] c"Number of people in room: \00"
@.str.1 = [20 x i8] c"Age of person #%i: \00"
@.str.3 = [51 x i8] c"A year from now, person #%i will be %i years old.\0A\00"
@str = [15 x i8] c"Time passes...\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @GetInt()
%4 = icmp slt i32 %3, 1
br i1 %4, label %1, label %5
5: ; preds = %1
%6 = zext i32 %3 to i64
%7 = alloca i32, i64 %6
%8 = zext i32 %3 to i64
br label %12
9: ; preds = %12
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%11 = icmp sgt i32 %3, 0
br i1 %11, label %21, label %20
12: ; preds = %5, %12
%13 = phi i64 [ 0, %5 ], [ %14, %12 ]
%14 = add nuw nsw i64 %13, 1
%15 = trunc i64 %14 to i32
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = tail call i32 (...) @GetInt()
%18 = getelementptr inbounds i32, i32* %7, i64 %13
store i32 %17, i32* %18
%19 = icmp eq i64 %14, %8
br i1 %19, label %9, label %12
20: ; preds = %21, %9
ret i32 0
21: ; preds = %9, %21
%22 = phi i64 [ %23, %21 ], [ 0, %9 ]
%23 = add nuw nsw i64 %22, 1
%24 = getelementptr inbounds i32, i32* %7, i64 %22
%25 = load i32, i32* %24
%26 = add nsw i32 %25, 1
%27 = trunc i64 %23 to i32
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %26)
%29 = icmp eq i64 %23, %6
br i1 %29, label %20, label %21
}