#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 *, char *, int);
int strlen(char *);
void get_key_length(int file_length, int *key_name_len, int *key_name_off,
                    char **key_name) {
  int i;
  for (i = 0; i < 8; i++) {
    key_name_len[i] = strlen(key_name[i]);
    printf("%s length : %d\n", key_name[i], key_name_len[i]);
  }
  key_name_off[i] = file_length;
}


x86 assembly (clang, -O0):
<get_key_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x8,-0x24(%rbp)
jge    1197 <get_key_length+0x77>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113e <get_key_length+0x1e>
mov    -0x4(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_key_length>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%rbp
mov    %edi,%r15d
mov    (%rcx),%rdi
call   1030 <strlen@plt>
mov    %eax,0x0(%rbp)
mov    (%rbx),%rsi
lea    0xeb7(%rip),%r12
mov    %r12,%rdi
mov    %eax,%edx
call   1040 <printf@plt>
mov    0x8(%rbx),%rdi
call   1030 <strlen@plt>
mov    %eax,0x4(%rbp)
mov    0x8(%rbx),%rsi
mov    %r12,%rdi
mov    %eax,%edx
call   1040 <printf@plt>
mov    0x10(%rbx),%rdi
call   1030 <strlen@plt>
mov    %eax,0x8(%rbp)
mov    0x10(%rbx),%rsi
mov    %r12,%rdi
mov    %eax,%edx
call   1040 <printf@plt>
mov    0x18(%rbx),%rdi
call   1030 <strlen@plt>
mov    %eax,0xc(%rbp)
mov    0x18(%rbx),%rsi
mov    %r12,%rdi
mov    %eax,%edx
call   1040 <printf@plt>
mov    0x20(%rbx),%rdi
call   1030 <strlen@plt>
mov    %eax,0x10(%rbp)
mov    0x20(%rbx),%rsi
mov    %r12,%rdi
mov    %eax,%edx
call   1040 <printf@plt>
mov    0x28(%rbx),%rdi
call   1030 <strlen@plt>
mov    %eax,0x14(%rbp)
mov    0x28(%rbx),%rsi
mov    %r12,%rdi
mov    %eax,%edx
call   1040 <printf@plt>
mov    0x30(%rbx),%rdi
call   1030 <strlen@plt>
mov    %eax,0x18(%rbp)
mov    0x30(%rbx),%rsi
mov    %r12,%rdi
mov    %eax,%edx
call   1040 <printf@plt>
mov    0x38(%rbx),%rdi
call   1030 <strlen@plt>
mov    %eax,0x1c(%rbp)
mov    0x38(%rbx),%rsi
mov    %r12,%rdi
mov    %eax,%edx
call   1040 <printf@plt>
mov    %r15d,0x20(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"%s length : %d\0A\00"
define void @get_key_length(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i8** nocapture %3) {
%5 = load i8*, i8** %3
%6 = tail call i32 @strlen(i8* %5)
store i32 %6, i32* %1
%7 = load i8*, i8** %3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %6)
%9 = getelementptr inbounds i8*, i8** %3, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @strlen(i8* %10)
%12 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %11, i32* %12
%13 = load i8*, i8** %9
%14 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %11)
%15 = getelementptr inbounds i8*, i8** %3, i64 2
%16 = load i8*, i8** %15
%17 = tail call i32 @strlen(i8* %16)
%18 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %17, i32* %18
%19 = load i8*, i8** %15
%20 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %19, i32 %17)
%21 = getelementptr inbounds i8*, i8** %3, i64 3
%22 = load i8*, i8** %21
%23 = tail call i32 @strlen(i8* %22)
%24 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %23, i32* %24
%25 = load i8*, i8** %21
%26 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %25, i32 %23)
%27 = getelementptr inbounds i8*, i8** %3, i64 4
%28 = load i8*, i8** %27
%29 = tail call i32 @strlen(i8* %28)
%30 = getelementptr inbounds i32, i32* %1, i64 4
store i32 %29, i32* %30
%31 = load i8*, i8** %27
%32 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %31, i32 %29)
%33 = getelementptr inbounds i8*, i8** %3, i64 5
%34 = load i8*, i8** %33
%35 = tail call i32 @strlen(i8* %34)
%36 = getelementptr inbounds i32, i32* %1, i64 5
store i32 %35, i32* %36
%37 = load i8*, i8** %33
%38 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %37, i32 %35)
%39 = getelementptr inbounds i8*, i8** %3, i64 6
%40 = load i8*, i8** %39
%41 = tail call i32 @strlen(i8* %40)
%42 = getelementptr inbounds i32, i32* %1, i64 6
store i32 %41, i32* %42
%43 = load i8*, i8** %39
%44 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %43, i32 %41)
%45 = getelementptr inbounds i8*, i8** %3, i64 7
%46 = load i8*, i8** %45
%47 = tail call i32 @strlen(i8* %46)
%48 = getelementptr inbounds i32, i32* %1, i64 7
store i32 %47, i32* %48
%49 = load i8*, i8** %45
%50 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %49, i32 %47)
%51 = getelementptr inbounds i32, i32* %2, i64 8
store i32 %0, i32* %51
ret void
}