#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*/ get_word_lengths(int *, int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int i;
  int word_lengths[10] = {0};
  get_word_lengths(word_lengths, 10);
  for (i = 1; i < 10; i++)
    printf("Num words of length %d - %d\n", i, word_lengths[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1050 <get_word_lengths@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1193 <main+0x63>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <main+0x34>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x20(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <get_word_lengths@plt>
mov    0x4(%rsp),%edx
lea    0xeae(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    0x24(%rsp),%edx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Num words of length %d - %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
store i32 0, i32* %1
%4 = bitcast [10 x i32]* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%6 = call i32 @get_word_lengths(i32* %5, i32 10)
store i32 1, i32* %2
br label %7
7: ; preds = %17, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = load i32, i32* %2
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %7
20: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Num words of length %d - %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @get_word_lengths(i32* %3, i32 10)
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%6 = load i32, i32* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 1, i32 %6)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 2, i32 %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 3, i32 %12)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 4, i32 %15)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 5, i32 %18)
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 6, i32 %21)
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 7, i32 %24)
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%27 = load i32, i32* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 8, i32 %27)
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 9, i32 %30)
ret i32 0
}