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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, ...);
char *tini_get_v(struct tini_base *, char *, char *);
int test_get_v(struct tini_base *base, char *s, char *k) {
  const char *v;
  if ((v = tini_get_v(base, s, k)) == NULL)
    printf("no value for %s\n", k);
  else
    printf("%s => %s\n", k, v);
  return 0;
}


x86 assembly (clang, -O0):
<test_get_v>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <tini_get_v@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    116a <test_get_v+0x4a>
mov    -0x18(%rbp),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1180 <test_get_v+0x60>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_get_v>:
push   %rbx
mov    %rdx,%rbx
call   1040 <tini_get_v@plt>
test   %rax,%rax
je     1144 <test_get_v+0x24>
lea    0xedc(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1155 <test_get_v+0x35>
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.tini_base = type { i32 }
@.str = [17 x i8] c"no value for %s\0A\00"
@.str.1 = [10 x i8] c"%s => %s\0A\00"
define i32 @test_get_v(%struct.tini_base* %0, i8* %1, i8* %2) {
%4 = alloca %struct.tini_base*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store %struct.tini_base* %0, %struct.tini_base** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load %struct.tini_base*, %struct.tini_base** %4
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i8* @tini_get_v(%struct.tini_base* %8, i8* %9, i8* %10)
store i8* %11, i8** %7
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load i8*, i8** %6
%15 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %20
16: ; preds = %3
%17 = load i8*, i8** %6
%18 = load i8*, i8** %7
%19 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %17, i8* %18)
br label %20
20: ; preds = %16, %13
ret i32 0
}

LLVM IR (-O2):
%struct.tini_base = type { i32 }
@.str = [17 x i8] c"no value for %s\0A\00"
@.str.1 = [10 x i8] c"%s => %s\0A\00"
define i32 @test_get_v(%struct.tini_base* %0, i8* %1, i8* %2) {
%4 = tail call i8* @tini_get_v(%struct.tini_base* %0, i8* %1, i8* %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %10
8: ; preds = %3
%9 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %4)
br label %10
10: ; preds = %8, %6
ret i32 0
}