#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 *, ...);
main() {
  int year = 1, endYearValue = 0, accumulatedDep = 0;
  printf("           DEPRECIATION SCHEDULE\n");
  printf("           ---------------------\n\n");
  printf("                      END-OF-YEAR  ACCUMULATED\n");
  printf("YEAR  DEPRECIATION      VALUE      DEPRECIATION\n");
  printf("----  ------------  -------------  ------------\n");
  while (year <= 7) {
    accumulatedDep = accumulatedDep + 4000;
    endYearValue = 28000 - accumulatedDep;
    printf("%2d %11d %15d %13d\n", year, 4000, endYearValue, accumulatedDep);
    year++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x7,-0x8(%rbp)
jg     11c5 <main+0xb5>
mov    -0x10(%rbp),%eax
add    $0xfa0,%eax
mov    %eax,-0x10(%rbp)
mov    $0x6d60,%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xf2c(%rip),%rdi
mov    $0xfa0,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117a <main+0x6a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
lea    0xf01(%rip),%rdi
call   1030 <puts@plt>
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf5e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0xfa0,%edx
mov    $0x5dc0,%ecx
mov    $0xfa0,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0xfa0,%edx
mov    $0x4e20,%ecx
mov    $0x1f40,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0xfa0,%edx
mov    $0x3e80,%ecx
mov    $0x2ee0,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0xfa0,%edx
mov    $0x2ee0,%ecx
mov    $0x3e80,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0xfa0,%edx
mov    $0x1f40,%ecx
mov    $0x4e20,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0xfa0,%edx
mov    $0xfa0,%ecx
mov    $0x5dc0,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0xfa0,%edx
xor    %ecx,%ecx
mov    $0x6d60,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c" DEPRECIATION SCHEDULE\0A\00"
@.str.1 = [35 x i8] c" ---------------------\0A\0A\00"
@.str.2 = [48 x i8] c" END-OF-YEAR ACCUMULATED\0A\00"
@.str.3 = [49 x i8] c"YEAR DEPRECIATION VALUE DEPRECIATION\0A\00"
@.str.4 = [49 x i8] c"---- ------------ ------------- ------------\0A\00"
@.str.5 = [20 x i8] c"%2d %11d %15d %13d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
br label %10
10: ; preds = %13, %0
%11 = load i32, i32* %2
%12 = icmp sle i32 %11, 7
br i1 %12, label %13, label %24
13: ; preds = %10
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 4000
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = sub nsw i32 28000, %16
store i32 %17, i32* %3
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %18, i32 4000, i32 %19, i32 %20)
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %10
24: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str.5 = [20 x i8] c"%2d %11d %15d %13d\0A\00"
@str = [33 x i8] c" DEPRECIATION SCHEDULE\00"
@str.6 = [34 x i8] c" ---------------------\0A\00"
@str.7 = [47 x i8] c" END-OF-YEAR ACCUMULATED\00"
@str.8 = [48 x i8] c"YEAR DEPRECIATION VALUE DEPRECIATION\00"
@str.9 = [48 x i8] c"---- ------------ ------------- ------------\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.6, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.7, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.8, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.9, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 1, i32 4000, i32 24000, i32 4000)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 2, i32 4000, i32 20000, i32 8000)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 3, i32 4000, i32 16000, i32 12000)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 4, i32 4000, i32 12000, i32 16000)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 5, i32 4000, i32 8000, i32 20000)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 6, i32 4000, i32 4000, i32 24000)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 7, i32 4000, i32 0, i32 28000)
ret i32 0
}