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

/* Variables and functions */
int /*<<< orphan*/ createKVP(struct map *, char *, char *);
struct map *createMap();
char *getValByKey(struct map *, char *);
int /*<<< orphan*/ modifyKey(struct map *, char *, char *);
int /*<<< orphan*/ modifyKeysByVal(struct map *, char *, char *);
int /*<<< orphan*/ printArray(struct map *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  struct map *head;
  head = createMap();
  createKVP(head, "first", "1st");
  createKVP(head, "sec", "2nd");
  printArray(head);
  createKVP(head, "first", "3rd");
  printArray(head);
  modifyKey(head, "sec", "second");
  printArray(head);
  modifyKeysByVal(head, "FIRST", "3rd");
  printArray(head);
  char *val = getValByKey(head, "FIRST");
  printf("THE VALUE OF KEY FIRST IS %s\n\n", val);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1070 <createMap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe64(%rip),%rsi
lea    0xe63(%rip),%rdx
call   1090 <createKVP@plt>
mov    -0x18(%rbp),%rdi
lea    0xe57(%rip),%rsi
lea    0xe54(%rip),%rdx
call   1090 <createKVP@plt>
mov    -0x18(%rbp),%rdi
call   1080 <printArray@plt>
mov    -0x18(%rbp),%rdi
lea    0xe2d(%rip),%rsi
lea    0xe38(%rip),%rdx
call   1090 <createKVP@plt>
mov    -0x18(%rbp),%rdi
call   1080 <printArray@plt>
mov    -0x18(%rbp),%rdi
lea    0xe17(%rip),%rsi
lea    0xe1c(%rip),%rdx
call   1030 <modifyKey@plt>
mov    -0x18(%rbp),%rdi
call   1080 <printArray@plt>
mov    -0x18(%rbp),%rdi
lea    0xe0a(%rip),%rsi
lea    0xdf8(%rip),%rdx
call   1040 <modifyKeysByVal@plt>
mov    -0x18(%rbp),%rdi
call   1080 <printArray@plt>
mov    -0x18(%rbp),%rdi
lea    0xdea(%rip),%rsi
call   1060 <getValByKey@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xddc(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <createMap@plt>
mov    %rax,%rbx
lea    0xe77(%rip),%r14
lea    0xe76(%rip),%rdx
mov    %rax,%rdi
mov    %r14,%rsi
call   1090 <createKVP@plt>
lea    0xe68(%rip),%r15
lea    0xe65(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <createKVP@plt>
mov    %rbx,%rdi
call   1080 <printArray@plt>
lea    0xe4f(%rip),%r12
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1090 <createKVP@plt>
mov    %rbx,%rdi
call   1080 <printArray@plt>
lea    0xe36(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <modifyKey@plt>
mov    %rbx,%rdi
call   1080 <printArray@plt>
lea    0xe23(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1040 <modifyKeysByVal@plt>
mov    %rbx,%rdi
call   1080 <printArray@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <getValByKey@plt>
lea    0xe01(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.map = type { i32 }
@.str = [6 x i8] c"first\00"
@.str.1 = [4 x i8] c"1st\00"
@.str.2 = [4 x i8] c"sec\00"
@.str.3 = [4 x i8] c"2nd\00"
@.str.4 = [4 x i8] c"3rd\00"
@.str.5 = [7 x i8] c"second\00"
@.str.6 = [6 x i8] c"FIRST\00"
@.str.7 = [31 x i8] c"THE VALUE OF KEY FIRST IS %s\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.map*
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call %struct.map* (...) @createMap()
store %struct.map* %8, %struct.map** %6
%9 = load %struct.map*, %struct.map** %6
%10 = call i32 @createKVP(%struct.map* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = load %struct.map*, %struct.map** %6
%12 = call i32 @createKVP(%struct.map* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%13 = load %struct.map*, %struct.map** %6
%14 = call i32 @printArray(%struct.map* %13)
%15 = load %struct.map*, %struct.map** %6
%16 = call i32 @createKVP(%struct.map* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%17 = load %struct.map*, %struct.map** %6
%18 = call i32 @printArray(%struct.map* %17)
%19 = load %struct.map*, %struct.map** %6
%20 = call i32 @modifyKey(%struct.map* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%21 = load %struct.map*, %struct.map** %6
%22 = call i32 @printArray(%struct.map* %21)
%23 = load %struct.map*, %struct.map** %6
%24 = call i32 @modifyKeysByVal(%struct.map* %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%25 = load %struct.map*, %struct.map** %6
%26 = call i32 @printArray(%struct.map* %25)
%27 = load %struct.map*, %struct.map** %6
%28 = call i8* @getValByKey(%struct.map* %27, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
store i8* %28, i8** %7
%29 = load i8*, i8** %7
%30 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %29)
ret i32 0
}

LLVM IR (-O2):
%struct.map = type { i32 }
@.str = [6 x i8] c"first\00"
@.str.1 = [4 x i8] c"1st\00"
@.str.2 = [4 x i8] c"sec\00"
@.str.3 = [4 x i8] c"2nd\00"
@.str.4 = [4 x i8] c"3rd\00"
@.str.5 = [7 x i8] c"second\00"
@.str.6 = [6 x i8] c"FIRST\00"
@.str.7 = [31 x i8] c"THE VALUE OF KEY FIRST IS %s\0A\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call %struct.map* (...) @createMap()
%4 = tail call i32 @createKVP(%struct.map* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @createKVP(%struct.map* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @printArray(%struct.map* %3)
%7 = tail call i32 @createKVP(%struct.map* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 @printArray(%struct.map* %3)
%9 = tail call i32 @modifyKey(%struct.map* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%10 = tail call i32 @printArray(%struct.map* %3)
%11 = tail call i32 @modifyKeysByVal(%struct.map* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%12 = tail call i32 @printArray(%struct.map* %3)
%13 = tail call i8* @getValByKey(%struct.map* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%14 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %13)
ret i32 0
}