#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 HashTable {
  int dummy;
};

/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ pq_insert_hash(struct HashTable *, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void pq_multi_insert_hash(struct HashTable *arghash, unsigned int argc,
                          char **argv) {
  char *key;
  char *value;
  unsigned int i;
  for (i = 0; i < argc; i += 2) {
    key = malloc(128 * sizeof(char));
    value = malloc(128 * sizeof(char));
    strcpy(key, argv[i]);
    strcpy(value, argv[i + 1]);
    pq_insert_hash(arghash, key, value);
  }
}


x86 assembly (clang, -O0):
<pq_multi_insert_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11be <pq_multi_insert_hash+0x8e>
mov    $0x80,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x80,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <pq_insert_hash@plt>
mov    -0x2c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x2c(%rbp)
jmp    114a <pq_multi_insert_hash+0x1a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pq_multi_insert_hash>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
je     119d <pq_multi_insert_hash+0x6d>
mov    %rdx,%r12
mov    %esi,%r15d
mov    %rdi,%r14
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x80,%edi
call   1050 <malloc@plt>
mov    %rax,%r13
mov    $0x80,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%eax
mov    (%r12,%rax,8),%rsi
mov    %r13,%rdi
call   1030 <strcpy@plt>
lea    0x1(%rbp),%eax
mov    (%r12,%rax,8),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1040 <pq_insert_hash@plt>
add    $0x2,%ebp
cmp    %r15d,%ebp
jb     1150 <pq_multi_insert_hash+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.HashTable = type { i32 }
define void @pq_multi_insert_hash(%struct.HashTable* %0, i32 %1, i8** %2) {
%4 = alloca %struct.HashTable*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store %struct.HashTable* %0, %struct.HashTable** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
store i32 0, i32* %9
br label %10
10: ; preds = %36, %3
%11 = load i32, i32* %9
%12 = load i32, i32* %5
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %39
14: ; preds = %10
%15 = call i8* @malloc(i32 128)
store i8* %15, i8** %7
%16 = call i8* @malloc(i32 128)
store i8* %16, i8** %8
%17 = load i8*, i8** %7
%18 = load i8**, i8*** %6
%19 = load i32, i32* %9
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @strcpy(i8* %17, i8* %22)
%24 = load i8*, i8** %8
%25 = load i8**, i8*** %6
%26 = load i32, i32* %9
%27 = add i32 %26, 1
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %25, i64 %28
%30 = load i8*, i8** %29
%31 = call i32 @strcpy(i8* %24, i8* %30)
%32 = load %struct.HashTable*, %struct.HashTable** %4
%33 = load i8*, i8** %7
%34 = load i8*, i8** %8
%35 = call i32 @pq_insert_hash(%struct.HashTable* %32, i8* %33, i8* %34)
br label %36
36: ; preds = %14
%37 = load i32, i32* %9
%38 = add i32 %37, 2
store i32 %38, i32* %9
br label %10
39: ; preds = %10
ret void
}

LLVM IR (-O2):
%struct.HashTable = type { i32 }
define void @pq_multi_insert_hash(%struct.HashTable* %0, i32 %1, i8** nocapture %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %21, label %5
5: ; preds = %3, %5
%6 = phi i32 [ %19, %5 ], [ 0, %3 ]
%7 = tail call dereferenceable_or_null(128) i8* @malloc(i32 128)
%8 = tail call dereferenceable_or_null(128) i8* @malloc(i32 128)
%9 = zext i32 %6 to i64
%10 = getelementptr inbounds i8*, i8** %2, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @strcpy(i8* %7, i8* %11)
%13 = or i32 %6, 1
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %2, i64 %14
%16 = load i8*, i8** %15
%17 = tail call i32 @strcpy(i8* %8, i8* %16)
%18 = tail call i32 @pq_insert_hash(%struct.HashTable* %0, i8* %7, i8* %8)
%19 = add i32 %6, 2
%20 = icmp ult i32 %19, %1
br i1 %20, label %5, label %21
21: ; preds = %5, %3
ret void
}