#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 */
scalar_t__ rec(int);
__attribute__((no)) int loop(int zero) {
  int t = 0, i, iter;
  for (iter = 0; iter < 20; ++iter) {
    t += rec(iter * 8);
  }
  return t;
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x14,-0x10(%rbp)
jge    1159 <loop+0x49>
mov    -0x10(%rbp),%edi
shl    $0x3,%edi
call   1030 <rec@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1129 <loop+0x19>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1030 <rec@plt>
mov    %rax,%r14
mov    $0x8,%edi
call   1030 <rec@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    $0x10,%edi
call   1030 <rec@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    $0x18,%edi
call   1030 <rec@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    $0x20,%edi
call   1030 <rec@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    $0x28,%edi
call   1030 <rec@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    $0x30,%edi
call   1030 <rec@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    $0x38,%edi
call   1030 <rec@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    $0x40,%edi
call   1030 <rec@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    $0x48,%edi
call   1030 <rec@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    $0x50,%edi
call   1030 <rec@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    $0x58,%edi
call   1030 <rec@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    $0x60,%edi
call   1030 <rec@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    $0x68,%edi
call   1030 <rec@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    $0x70,%edi
call   1030 <rec@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    $0x78,%edi
call   1030 <rec@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    $0x80,%edi
call   1030 <rec@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    $0x88,%edi
call   1030 <rec@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    $0x90,%edi
call   1030 <rec@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    $0x98,%edi
call   1030 <rec@plt>
add    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @loop(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %5
br label %6
6: ; preds = %17, %1
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 20
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %5
%11 = mul nsw i32 %10, 8
%12 = call i64 @rec(i32 %11)
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = add nsw i64 %14, %12
%16 = trunc i64 %15 to i32
store i32 %16, i32* %3
br label %17
17: ; preds = %9
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @loop(i32 %0) {
%2 = tail call i64 @rec(i32 0)
%3 = trunc i64 %2 to i32
%4 = tail call i64 @rec(i32 8)
%5 = trunc i64 %4 to i32
%6 = add i32 %3, %5
%7 = tail call i64 @rec(i32 16)
%8 = trunc i64 %7 to i32
%9 = add i32 %6, %8
%10 = tail call i64 @rec(i32 24)
%11 = trunc i64 %10 to i32
%12 = add i32 %9, %11
%13 = tail call i64 @rec(i32 32)
%14 = trunc i64 %13 to i32
%15 = add i32 %12, %14
%16 = tail call i64 @rec(i32 40)
%17 = trunc i64 %16 to i32
%18 = add i32 %15, %17
%19 = tail call i64 @rec(i32 48)
%20 = trunc i64 %19 to i32
%21 = add i32 %18, %20
%22 = tail call i64 @rec(i32 56)
%23 = trunc i64 %22 to i32
%24 = add i32 %21, %23
%25 = tail call i64 @rec(i32 64)
%26 = trunc i64 %25 to i32
%27 = add i32 %24, %26
%28 = tail call i64 @rec(i32 72)
%29 = trunc i64 %28 to i32
%30 = add i32 %27, %29
%31 = tail call i64 @rec(i32 80)
%32 = trunc i64 %31 to i32
%33 = add i32 %30, %32
%34 = tail call i64 @rec(i32 88)
%35 = trunc i64 %34 to i32
%36 = add i32 %33, %35
%37 = tail call i64 @rec(i32 96)
%38 = trunc i64 %37 to i32
%39 = add i32 %36, %38
%40 = tail call i64 @rec(i32 104)
%41 = trunc i64 %40 to i32
%42 = add i32 %39, %41
%43 = tail call i64 @rec(i32 112)
%44 = trunc i64 %43 to i32
%45 = add i32 %42, %44
%46 = tail call i64 @rec(i32 120)
%47 = trunc i64 %46 to i32
%48 = add i32 %45, %47
%49 = tail call i64 @rec(i32 128)
%50 = trunc i64 %49 to i32
%51 = add i32 %48, %50
%52 = tail call i64 @rec(i32 136)
%53 = trunc i64 %52 to i32
%54 = add i32 %51, %53
%55 = tail call i64 @rec(i32 144)
%56 = trunc i64 %55 to i32
%57 = add i32 %54, %56
%58 = tail call i64 @rec(i32 152)
%59 = trunc i64 %58 to i32
%60 = add i32 %57, %59
ret i32 %60
}