#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 const *, char *, char *, char *);
scalar_t__ strcmp(char const *, char *);
int db_walk_strings(const char *key, void *data, int len) {
  static char kstr[2] = "a", vstr[2] = "1";
  if (strcmp(key, kstr) || strcmp((char *)data, vstr)) {
    printf("'%s' '%s' != '%s' %s'\n", key, (char *)data, kstr, vstr);
    return 1;
  }
  ++*kstr;
  ++*vstr;
  return 0;
}


x86 assembly (clang, -O0):
<db_walk_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    0x2ef2(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1167 <db_walk_strings+0x47>
mov    -0x18(%rbp),%rdi
lea    0x2eda(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1195 <db_walk_strings+0x75>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe8a(%rip),%rdi
lea    0x2eb3(%rip),%rcx
lea    0x2eae(%rip),%r8
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11b8 <db_walk_strings+0x98>
mov    0x2e95(%rip),%al
add    $0x1,%al
mov    %al,0x2e8d(%rip)
mov    0x2e89(%rip),%al
add    $0x1,%al
mov    %al,0x2e81(%rip)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_walk_strings>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x2eff(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    114f <db_walk_strings+0x2f>
lea    0x2ef0(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     117c <db_walk_strings+0x5c>
lea    0xeaa(%rip),%rdi
lea    0x2ed3(%rip),%rcx
lea    0x2ece(%rip),%r8
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
addb   $0x1,0x2ead(%rip)
addb   $0x1,0x2ea8(%rip)
xor    %eax,%eax
jmp    1174 <db_walk_strings+0x54>

LLVM IR (-O0):
@db_walk_strings.kstr = internal global [2 x i8] c"a\00"
@db_walk_strings.vstr = internal global [2 x i8] c"1\00"
@.str = [23 x i8] c"'%s' '%s' != '%s' %s'\0A\00"
define i32 @db_walk_strings(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i8*, i8** %5
%9 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.kstr, i64 0, i64 0))
%10 = icmp ne i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %3
%12 = load i8*, i8** %6
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.vstr, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %11, %3
%16 = load i8*, i8** %5
%17 = load i8*, i8** %6
%18 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.kstr, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.vstr, i64 0, i64 0))
store i32 1, i32* %4
br label %24
19: ; preds = %11
%20 = load i8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.kstr, i64 0, i64 0)
%21 = add i8 %20, 1
store i8 %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.kstr, i64 0, i64 0)
%22 = load i8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.vstr, i64 0, i64 0)
%23 = add i8 %22, 1
store i8 %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.vstr, i64 0, i64 0)
store i32 0, i32* %4
br label %24
24: ; preds = %19, %15
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
@db_walk_strings.kstr = internal global [2 x i8] c"a\00"
@db_walk_strings.vstr = internal global [2 x i8] c"1\00"
@.str = [23 x i8] c"'%s' '%s' != '%s' %s'\0A\00"
define i32 @db_walk_strings(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.kstr, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.vstr, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6, %3
%10 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.kstr, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.vstr, i64 0, i64 0))
br label %16
11: ; preds = %6
%12 = load i8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.kstr, i64 0, i64 0)
%13 = add i8 %12, 1
store i8 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.kstr, i64 0, i64 0)
%14 = load i8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.vstr, i64 0, i64 0)
%15 = add i8 %14, 1
store i8 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @db_walk_strings.vstr, i64 0, i64 0)
br label %16
16: ; preds = %11, %9
%17 = phi i32 [ 1, %9 ], [ 0, %11 ]
ret i32 %17
}