#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 */
scalar_t__ strcmp(char const *, char *);
int variable_callback(void *user_data, const char *name, double *value) {
  if (strcmp(name, "var0") == 0) {
    *value = 0.0;
    return (!0);
  } else if (strcmp(name, "var1") == 0) {
    *value = 1.0;
    return (!0);
  } else if (strcmp(name, "var2") == 0) {
    *value = 2.0;
    return (!0);
  } else if (strcmp(name, "var3") == 0) {
    *value = 3.0;
    return (!0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<variable_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xee9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1155 <variable_callback+0x45>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    120d <variable_callback+0xfd>
mov    -0x18(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    118b <variable_callback+0x7b>
mov    -0x20(%rbp),%rax
movsd  0xe95(%rip),%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    120d <variable_callback+0xfd>
mov    -0x18(%rbp),%rdi
lea    0xe8c(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11c1 <variable_callback+0xb1>
mov    -0x20(%rbp),%rax
movsd  0xe57(%rip),%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    120d <variable_callback+0xfd>
mov    -0x18(%rbp),%rdi
lea    0xe5b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11f7 <variable_callback+0xe7>
mov    -0x20(%rbp),%rax
movsd  0xe19(%rip),%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    120d <variable_callback+0xfd>
jmp    11fc <variable_callback+0xec>
jmp    1201 <variable_callback+0xf1>
jmp    1206 <variable_callback+0xf6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<variable_callback>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
lea    0xef7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1179 <variable_callback+0x69>
lea    0xee8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     117e <variable_callback+0x6e>
lea    0xed9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1188 <variable_callback+0x78>
lea    0xeca(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    119a <variable_callback+0x8a>
movsd  0xe99(%rip),%xmm0
jmp    1190 <variable_callback+0x80>
xorps  %xmm0,%xmm0
jmp    1190 <variable_callback+0x80>
movsd  0xe7a(%rip),%xmm0
jmp    1190 <variable_callback+0x80>
movsd  0xe78(%rip),%xmm0
movsd  %xmm0,(%r14)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"var0\00"
@.str.1 = [5 x i8] c"var1\00"
@.str.2 = [5 x i8] c"var2\00"
@.str.3 = [5 x i8] c"var3\00"
define i32 @variable_callback(i8* %0, i8* %1, double* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca double*
store i8* %0, i8** %5
store i8* %1, i8** %6
store double* %2, double** %7
%8 = load i8*, i8** %6
%9 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load double*, double** %7
store double 0.000000e+00, double* %12
store i32 1, i32* %4
br label %35
13: ; preds = %3
%14 = load i8*, i8** %6
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load double*, double** %7
store double 1.000000e+00, double* %18
store i32 1, i32* %4
br label %35
19: ; preds = %13
%20 = load i8*, i8** %6
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = load double*, double** %7
store double 2.000000e+00, double* %24
store i32 1, i32* %4
br label %35
25: ; preds = %19
%26 = load i8*, i8** %6
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = load double*, double** %7
store double 3.000000e+00, double* %30
store i32 1, i32* %4
br label %35
31: ; preds = %25
br label %32
32: ; preds = %31
br label %33
33: ; preds = %32
br label %34
34: ; preds = %33
store i32 0, i32* %4
br label %35
35: ; preds = %34, %29, %23, %17, %11
%36 = load i32, i32* %4
ret i32 %36
}

LLVM IR (-O2):
@.str = [5 x i8] c"var0\00"
@.str.1 = [5 x i8] c"var1\00"
@.str.2 = [5 x i8] c"var2\00"
@.str.3 = [5 x i8] c"var3\00"
define i32 @variable_callback(i8* nocapture readnone %0, i8* %1, double* nocapture writeonly %2) {
%4 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3
%7 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %6
%10 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12, %9, %6, %3
%16 = phi double [ 0.000000e+00, %3 ], [ 1.000000e+00, %6 ], [ 2.000000e+00, %9 ], [ 3.000000e+00, %12 ]
store double %16, double* %2
br label %17
17: ; preds = %15, %12
%18 = phi i32 [ 0, %12 ], [ 1, %15 ]
ret i32 %18
}