#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 *);
scalar_t__ unlikely(int);
int rrdset_type_id(const char *name) {
  if (unlikely(strcmp(name, "area") == 0))
    return 1;
  else if (unlikely(strcmp(name, "stacked") == 0))
    return 2;
  else if (unlikely(strcmp(name, "line") == 0))
    return 0;
  return 0;
}


x86 assembly (clang, -O0):
<rrdset_type_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <unlikely@plt>
cmp    $0x0,%rax
je     1163 <rrdset_type_id+0x43>
movl   $0x1,-0x4(%rbp)
jmp    11e2 <rrdset_type_id+0xc2>
mov    -0x10(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <unlikely@plt>
cmp    $0x0,%rax
je     119a <rrdset_type_id+0x7a>
movl   $0x2,-0x4(%rbp)
jmp    11e2 <rrdset_type_id+0xc2>
mov    -0x10(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <unlikely@plt>
cmp    $0x0,%rax
je     11d1 <rrdset_type_id+0xb1>
movl   $0x0,-0x4(%rbp)
jmp    11e2 <rrdset_type_id+0xc2>
jmp    11d6 <rrdset_type_id+0xb6>
jmp    11db <rrdset_type_id+0xbb>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rrdset_type_id>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <unlikely@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     114d <rrdset_type_id+0x2d>
pop    %rbx
ret
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <unlikely@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
jne    114b <rrdset_type_id+0x2b>
lea    0xe8f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <unlikely@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"area\00"
@.str.1 = [8 x i8] c"stacked\00"
@.str.2 = [5 x i8] c"line\00"
define i32 @rrdset_type_id(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
%8 = call i64 @unlikely(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 1, i32* %2
br label %30
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = call i64 @unlikely(i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %11
store i32 2, i32* %2
br label %30
19: ; preds = %11
%20 = load i8*, i8** %3
%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
%23 = zext i1 %22 to i32
%24 = call i64 @unlikely(i32 %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %19
store i32 0, i32* %2
br label %30
27: ; preds = %19
br label %28
28: ; preds = %27
br label %29
29: ; preds = %28
store i32 0, i32* %2
br label %30
30: ; preds = %29, %26, %18, %10
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
@.str = [5 x i8] c"area\00"
@.str.1 = [8 x i8] c"stacked\00"
@.str.2 = [5 x i8] c"line\00"
define i32 @rrdset_type_id(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i64 @unlikely(i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %18
7: ; preds = %1
%8 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
%11 = tail call i64 @unlikely(i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
%17 = tail call i64 @unlikely(i32 %16)
br label %18
18: ; preds = %13, %7, %1
%19 = phi i32 [ 1, %1 ], [ 2, %7 ], [ 0, %13 ]
ret i32 %19
}