#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 */
struct hash {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ hashAdd(struct hash *, char *, char *);
struct hash *newHashExt(int /*<<< orphan*/, int);
struct hash *hashFromNameValArray(char *nameVal[][2], int nameValCount) {
  struct hash *hash = newHashExt(0, 1);
  int i;
  for (i = 0; i < nameValCount; ++i)
    hashAdd(hash, nameVal[i][0], nameVal[i][1]);
  return hash;
}


x86 assembly (clang, -O0):
<hashFromNameValArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <newHashExt@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118e <hashFromNameValArray+0x6e>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rsi
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rdx
call   1040 <hashAdd@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1146 <hashFromNameValArray+0x26>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashFromNameValArray>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <newHashExt@plt>
mov    %rax,%r14
test   %ebp,%ebp
jle    116a <hashFromNameValArray+0x4a>
mov    %ebp,%r15d
shl    $0x4,%r15
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,1),%rsi
mov    0x8(%rbx,%rbp,1),%rdx
mov    %r14,%rdi
call   1040 <hashAdd@plt>
add    $0x10,%rbp
cmp    %rbp,%r15
jne    1150 <hashFromNameValArray+0x30>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.hash = type { i32 }
define %struct.hash* @hashFromNameValArray([2 x i8*]* %0, i32 %1) {
%3 = alloca [2 x i8*]*
%4 = alloca i32
%5 = alloca %struct.hash*
%6 = alloca i32
store [2 x i8*]* %0, [2 x i8*]** %3
store i32 %1, i32* %4
%7 = call %struct.hash* @newHashExt(i32 0, i32 1)
store %struct.hash* %7, %struct.hash** %5
store i32 0, i32* %6
br label %8
8: ; preds = %27, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %30
12: ; preds = %8
%13 = load %struct.hash*, %struct.hash** %5
%14 = load [2 x i8*]*, [2 x i8*]** %3
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [2 x i8*], [2 x i8*]* %14, i64 %16
%18 = getelementptr inbounds [2 x i8*], [2 x i8*]* %17, i64 0, i64 0
%19 = load i8*, i8** %18
%20 = load [2 x i8*]*, [2 x i8*]** %3
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [2 x i8*], [2 x i8*]* %20, i64 %22
%24 = getelementptr inbounds [2 x i8*], [2 x i8*]* %23, i64 0, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @hashAdd(%struct.hash* %13, i8* %19, i8* %25)
br label %27
27: ; preds = %12
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %8
30: ; preds = %8
%31 = load %struct.hash*, %struct.hash** %5
ret %struct.hash* %31
}

LLVM IR (-O2):
%struct.hash = type { i32 }
define %struct.hash* @hashFromNameValArray([2 x i8*]* nocapture %0, i32 %1) {
%3 = tail call %struct.hash* @newHashExt(i32 0, i32 1)
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %16
5: ; preds = %2
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %14, %7 ]
%9 = getelementptr inbounds [2 x i8*], [2 x i8*]* %0, i64 %8, i64 0
%10 = load i8*, i8** %9
%11 = getelementptr inbounds [2 x i8*], [2 x i8*]* %0, i64 %8, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @hashAdd(%struct.hash* %3, i8* %10, i8* %12)
%14 = add nuw nsw i64 %8, 1
%15 = icmp eq i64 %14, %6
br i1 %15, label %16, label %7
16: ; preds = %7, %2
ret %struct.hash* %3
}