#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ destroy(void *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ find(void *, char *, int *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
void *initialize();
int /*<<< orphan*/ insert(void *, char *, int);
scalar_t__ isspace(int);
int parse_key_value(char *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
char *strtok(char *, char *);
int main(int argc, char *argv[]) {
  char s[2 * 30];
  char key[2 * 30];
  char *tok;
  char op;
  int v;
  int i;
  FILE *input;
  void *ds;
  if (argc != 2) {
    fprintf(stderr, "input file needed\n");
    exit(EXIT_FAILURE);
  }
  ds = initialize();
  input = fopen(argv[1], "r");
  if (input == NULL) {
    fprintf(stderr, "Aborting, cannot open file: %s\n", argv[1]);
    exit(EXIT_FAILURE);
  }
  while (fgets(s, 30 + 1, input) != NULL) {
    tok = strtok(s, ",");
    if (tok == NULL) {
      continue;
    }
    for (i = 0; isspace(i) && tok[i] != '\0'; i++) {
    }
    op = tok[i];
    switch (op) {
    case 'i':
      if (parse_key_value(key, &v) == 2) {
        insert(ds, key, v);
      }
      break;
    case 'd':
      if (parse_key_value(key, &v) == 1) {
        destroy(ds, key);
      }
      break;
    case 'f':
      if (parse_key_value(key, &v) == 1) {
        if (find(ds, key, &v)) {
          printf("Value %8d for key "
                 "'%-s'\n",
                 v, key);
        } else {
          printf("No record      for "
                 "key '%-s'\n",
                 key);
        }
      }
      break;
    default:
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1208 <main+0x48>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
lea    0xe0d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    $0x0,%al
call   1050 <initialize@plt>
mov    %rax,-0xb8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdee(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0xb0(%rbp)
cmpq   $0x0,-0xb0(%rbp)
jne    126c <main+0xac>
mov    0x2d9a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdbe(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
jmp    1271 <main+0xb1>
lea    -0x50(%rbp),%rdi
mov    -0xb0(%rbp),%rdx
mov    $0x1f,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     147e <main+0x2be>
lea    -0x50(%rbp),%rdi
lea    0xd9a(%rip),%rsi
call   10d0 <strtok@plt>
mov    %rax,-0x98(%rbp)
cmpq   $0x0,-0x98(%rbp)
jne    12ba <main+0xfa>
jmp    1271 <main+0xb1>
movl   $0x0,-0xa4(%rbp)
mov    -0xa4(%rbp),%edi
call   1040 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xb9(%rbp)
je     1302 <main+0x142>
mov    -0x98(%rbp),%rax
movslq -0xa4(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xb9(%rbp)
mov    -0xb9(%rbp),%al
test   $0x1,%al
jne    1315 <main+0x155>
jmp    132e <main+0x16e>
jmp    131a <main+0x15a>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    12c4 <main+0x104>
mov    -0x98(%rbp),%rax
movslq -0xa4(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x99(%rbp)
movsbl -0x99(%rbp),%eax
mov    %eax,-0xc0(%rbp)
sub    $0x64,%eax
je     13c2 <main+0x202>
jmp    1360 <main+0x1a0>
mov    -0xc0(%rbp),%eax
sub    $0x66,%eax
je     13f6 <main+0x236>
jmp    1374 <main+0x1b4>
mov    -0xc0(%rbp),%eax
sub    $0x69,%eax
jne    1474 <main+0x2b4>
jmp    1388 <main+0x1c8>
lea    -0x90(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   10c0 <parse_key_value@plt>
cmp    $0x2,%eax
jne    13bd <main+0x1fd>
mov    -0xb8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    -0xa0(%rbp),%edx
call   10a0 <insert@plt>
jmp    1479 <main+0x2b9>
lea    -0x90(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   10c0 <parse_key_value@plt>
cmp    $0x1,%eax
jne    13f1 <main+0x231>
mov    -0xb8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1070 <destroy@plt>
jmp    1479 <main+0x2b9>
lea    -0x90(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   10c0 <parse_key_value@plt>
cmp    $0x1,%eax
jne    146f <main+0x2af>
mov    -0xb8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
call   1090 <find@plt>
cmp    $0x0,%eax
je     1455 <main+0x295>
mov    -0xa0(%rbp),%esi
lea    -0x90(%rbp),%rdx
lea    0xbee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    146a <main+0x2aa>
lea    -0x90(%rbp),%rsi
lea    0xbed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    146f <main+0x2af>
jmp    1479 <main+0x2b9>
jmp    1479 <main+0x2b9>
jmp    1271 <main+0xb1>
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
cmp    $0x2,%edi
jne    1367 <main+0x1a7>
mov    %rsi,%rbp
xor    %eax,%eax
call   1050 <initialize@plt>
mov    %rax,0x8(%rsp)
mov    0x8(%rbp),%rdi
lea    0xe1f(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     1380 <main+0x1c0>
mov    %rax,%rbx
lea    0x10(%rsp),%rdi
mov    $0x1f,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1353 <main+0x193>
lea    0xe0e(%rip),%r15
lea    0x10(%rsp),%r12
lea    0x50(%rsp),%r13
jmp    1269 <main+0xa9>
mov    0x4(%rsp),%esi
lea    0xdf9(%rip),%rdi
mov    %r13,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    $0x1f,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1353 <main+0x193>
mov    %r12,%rdi
mov    %r15,%rsi
call   10d0 <strtok@plt>
test   %rax,%rax
je     1250 <main+0x90>
mov    %rax,%r14
xor    %edi,%edi
call   1040 <isspace@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     12a7 <main+0xe7>
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%r14,%rbp,1)
je     12a7 <main+0xe7>
add    $0x1,%rbp
mov    %ebp,%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    1290 <main+0xd0>
mov    %ebp,%eax
movsbl (%r14,%rax,1),%eax
cmp    $0x64,%eax
je     132b <main+0x16b>
cmp    $0x66,%eax
je     12e5 <main+0x125>
cmp    $0x69,%eax
jne    1250 <main+0x90>
mov    %r13,%rdi
lea    0x4(%rsp),%rsi
call   10c0 <parse_key_value@plt>
cmp    $0x2,%eax
jne    1250 <main+0x90>
mov    0x4(%rsp),%edx
mov    0x8(%rsp),%rdi
mov    %r13,%rsi
call   10a0 <insert@plt>
jmp    1250 <main+0x90>
mov    %r13,%rdi
lea    0x4(%rsp),%rsi
call   10c0 <parse_key_value@plt>
cmp    $0x1,%eax
jne    1250 <main+0x90>
mov    0x8(%rsp),%rdi
mov    %r13,%rsi
lea    0x4(%rsp),%rdx
call   1090 <find@plt>
test   %eax,%eax
jne    1233 <main+0x73>
lea    0xd34(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1250 <main+0x90>
mov    %r13,%rdi
lea    0x4(%rsp),%rsi
call   10c0 <parse_key_value@plt>
cmp    $0x1,%eax
jne    1250 <main+0x90>
mov    0x8(%rsp),%rdi
mov    %r13,%rsi
call   1070 <destroy@plt>
jmp    1250 <main+0x90>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c72(%rip),%rax
mov    (%rax),%edi
lea    0xc89(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    139b <main+0x1db>
mov    0x2c59(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbp),%rdx
lea    0xc81(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x2c36(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"input file needed\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [32 x i8] c"Aborting, cannot open file: %s\0A\00"
@.str.3 = [2 x i8] c",\00"
@.str.4 = [25 x i8] c"Value %8d for key '%-s'\0A\00"
@.str.5 = [30 x i8] c"No record for key '%-s'\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [60 x i8]
%7 = alloca [60 x i8]
%8 = alloca i8*
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 2
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = call i8* (...) @initialize()
store i8* %22, i8** %13
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %12
%27 = load i32*, i32** %12
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %37
29: ; preds = %21
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %33)
%35 = load i32, i32* @EXIT_FAILURE
%36 = call i32 @exit(i32 %35)
unreachable
37: ; preds = %21
br label %38
38: ; preds = %114, %48, %37
%39 = getelementptr inbounds [60 x i8], [60 x i8]* %6, i64 0, i64 0
%40 = load i32*, i32** %12
%41 = call i32* @fgets(i8* %39, i32 31, i32* %40)
%42 = icmp ne i32* %41, null
br i1 %42, label %43, label %115
43: ; preds = %38
%44 = getelementptr inbounds [60 x i8], [60 x i8]* %6, i64 0, i64 0
%45 = call i8* @strtok(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %45, i8** %8
%46 = load i8*, i8** %8
%47 = icmp eq i8* %46, null
br i1 %47, label %48, label %49
48: ; preds = %43
br label %38
49: ; preds = %43
store i32 0, i32* %11
br label %50
50: ; preds = %65, %49
%51 = load i32, i32* %11
%52 = call i64 @isspace(i32 %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %62
54: ; preds = %50
%55 = load i8*, i8** %8
%56 = load i32, i32* %11
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp ne i32 %60, 0
br label %62
62: ; preds = %54, %50
%63 = phi i1 [ false, %50 ], [ %61, %54 ]
br i1 %63, label %64, label %68
64: ; preds = %62
br label %65
65: ; preds = %64
%66 = load i32, i32* %11
%67 = add nsw i32 %66, 1
store i32 %67, i32* %11
br label %50
68: ; preds = %62
%69 = load i8*, i8** %8
%70 = load i32, i32* %11
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %69, i64 %71
%73 = load i8, i8* %72
store i8 %73, i8* %9
%74 = load i8, i8* %9
%75 = sext i8 %74 to i32
switch i32 %75, label %113 [
i32 105, label %76
i32 100, label %86
i32 102, label %95
]
76: ; preds = %68
%77 = getelementptr inbounds [60 x i8], [60 x i8]* %7, i64 0, i64 0
%78 = call i32 @parse_key_value(i8* %77, i32* %10)
%79 = icmp eq i32 %78, 2
br i1 %79, label %80, label %85
80: ; preds = %76
%81 = load i8*, i8** %13
%82 = getelementptr inbounds [60 x i8], [60 x i8]* %7, i64 0, i64 0
%83 = load i32, i32* %10
%84 = call i32 @insert(i8* %81, i8* %82, i32 %83)
br label %85
85: ; preds = %80, %76
br label %114
86: ; preds = %68
%87 = getelementptr inbounds [60 x i8], [60 x i8]* %7, i64 0, i64 0
%88 = call i32 @parse_key_value(i8* %87, i32* %10)
%89 = icmp eq i32 %88, 1
br i1 %89, label %90, label %94
90: ; preds = %86
%91 = load i8*, i8** %13
%92 = getelementptr inbounds [60 x i8], [60 x i8]* %7, i64 0, i64 0
%93 = call i32 @destroy(i8* %91, i8* %92)
br label %94
94: ; preds = %90, %86
br label %114
95: ; preds = %68
%96 = getelementptr inbounds [60 x i8], [60 x i8]* %7, i64 0, i64 0
%97 = call i32 @parse_key_value(i8* %96, i32* %10)
%98 = icmp eq i32 %97, 1
br i1 %98, label %99, label %112
99: ; preds = %95
%100 = load i8*, i8** %13
%101 = getelementptr inbounds [60 x i8], [60 x i8]* %7, i64 0, i64 0
%102 = call i32 @find(i8* %100, i8* %101, i32* %10)
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %108
104: ; preds = %99
%105 = load i32, i32* %10
%106 = getelementptr inbounds [60 x i8], [60 x i8]* %7, i64 0, i64 0
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %105, i8* %106)
br label %111
108: ; preds = %99
%109 = getelementptr inbounds [60 x i8], [60 x i8]* %7, i64 0, i64 0
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %109)
br label %111
111: ; preds = %108, %104
br label %112
112: ; preds = %111, %95
br label %114
113: ; preds = %68
br label %114
114: ; preds = %113, %112, %94, %85
br label %38
115: ; preds = %38
%116 = load i32, i32* %3
ret i32 %116
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"input file needed\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [32 x i8] c"Aborting, cannot open file: %s\0A\00"
@.str.3 = [2 x i8] c",\00"
@.str.4 = [25 x i8] c"Value %8d for key '%-s'\0A\00"
@.str.5 = [30 x i8] c"No record for key '%-s'\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [60 x i8]
%4 = alloca [60 x i8]
%5 = alloca i32
%6 = getelementptr inbounds [60 x i8], [60 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [60 x i8], [60 x i8]* %4, i64 0, i64 0
%8 = bitcast i32* %5 to i8*
%9 = icmp eq i32 %0, 2
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
%14 = tail call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = tail call i8* (...) @initialize()
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = tail call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i32* %19, null
br i1 %20, label %24, label %21
21: ; preds = %15
%22 = call i32* @fgets(i8* %6, i32 31, i32* %19)
%23 = icmp eq i32* %22, null
br i1 %23, label %77, label %30
24: ; preds = %15
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %17
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = load i32, i32* @EXIT_FAILURE
%29 = tail call i32 @exit(i32 %28)
unreachable
30: ; preds = %21, %74
%31 = call i8* @strtok(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i8* %31, null
br i1 %32, label %74, label %33
33: ; preds = %30
%34 = call i64 @isspace(i32 0)
%35 = icmp eq i64 %34, 0
br i1 %35, label %46, label %36
36: ; preds = %33, %41
%37 = phi i64 [ %42, %41 ], [ 0, %33 ]
%38 = getelementptr inbounds i8, i8* %31, i64 %37
%39 = load i8, i8* %38
%40 = icmp eq i8 %39, 0
br i1 %40, label %46, label %41
41: ; preds = %36
%42 = add nuw i64 %37, 1
%43 = trunc i64 %42 to i32
%44 = call i64 @isspace(i32 %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %36
46: ; preds = %36, %41, %33
%47 = phi i64 [ 0, %33 ], [ %42, %41 ], [ %37, %36 ]
%48 = and i64 %47, 4294967295
%49 = getelementptr inbounds i8, i8* %31, i64 %48
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
switch i32 %51, label %74 [
i32 105, label %52
i32 100, label %58
i32 102, label %63
]
52: ; preds = %46
%53 = call i32 @parse_key_value(i8* %7, i32* %5)
%54 = icmp eq i32 %53, 2
br i1 %54, label %55, label %74
55: ; preds = %52
%56 = load i32, i32* %5
%57 = call i32 @insert(i8* %16, i8* %7, i32 %56)
br label %74
58: ; preds = %46
%59 = call i32 @parse_key_value(i8* %7, i32* %5)
%60 = icmp eq i32 %59, 1
br i1 %60, label %61, label %74
61: ; preds = %58
%62 = call i32 @destroy(i8* %16, i8* %7)
br label %74
63: ; preds = %46
%64 = call i32 @parse_key_value(i8* %7, i32* %5)
%65 = icmp eq i32 %64, 1
br i1 %65, label %66, label %74
66: ; preds = %63
%67 = call i32 @find(i8* %16, i8* %7, i32* %5)
%68 = icmp eq i32 %67, 0
br i1 %68, label %72, label %69
69: ; preds = %66
%70 = load i32, i32* %5
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %70, i8* %7)
br label %74
72: ; preds = %66
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %7)
br label %74
74: ; preds = %55, %52, %61, %58, %69, %72, %63, %46, %30
%75 = call i32* @fgets(i8* %6, i32 31, i32* %19)
%76 = icmp eq i32* %75, null
br i1 %76, label %77, label %30
77: ; preds = %74, %21
ret i32 0
}