int snd_pcm_conf_generic_id(const char *id) {
  static const char ids[3][8] = {"comment", "type", "hint"};
  unsigned int k;
  for (k = 0; k < sizeof(ids) / sizeof(ids[0]); ++k) {
    if (strcmp(id, ids[k]) == 0)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<snd_pcm_conf_generic_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    $0x3,%rax
jae    1172 <snd_pcm_conf_generic_id+0x62>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%eax
lea    0xec2(%rip),%rsi
shl    $0x3,%rax
add    %rax,%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    115f <snd_pcm_conf_generic_id+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    1179 <snd_pcm_conf_generic_id+0x69>
jmp    1164 <snd_pcm_conf_generic_id+0x54>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <snd_pcm_conf_generic_id+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snd_pcm_conf_generic_id>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee3(%rip),%rsi
call   1030 <strcmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1155 <snd_pcm_conf_generic_id+0x45>
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1155 <snd_pcm_conf_generic_id+0x45>
lea    0xecb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@snd_pcm_conf_generic_id.ids = internal constant [3 x [8 x i8]] [[8 x i8] c"comment\00", [8 x i8] c"type\00\00\00\00", [8 x i8] c"hint\00\00\00\00"]
define i32 @snd_pcm_conf_generic_id(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %19, %1
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = icmp ult i64 %7, 3
br i1 %8, label %9, label %22
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds [3 x [8 x i8]], [3 x [8 x i8]]* @snd_pcm_conf_generic_id.ids, i64 0, i64 %12
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%15 = call i32 @strcmp(i8* %10, i8* %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %9
store i32 1, i32* %2
br label %23
18: ; preds = %9
br label %19
19: ; preds = %18
%20 = load i32, i32* %4
%21 = add i32 %20, 1
store i32 %21, i32* %4
br label %5
22: ; preds = %5
store i32 0, i32* %2
br label %23
23: ; preds = %22, %17
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
@snd_pcm_conf_generic_id.ids = internal constant [3 x [8 x i8]] [[8 x i8] c"comment\00", [8 x i8] c"type\00\00\00\00", [8 x i8] c"hint\00\00\00\00"]
define i32 @snd_pcm_conf_generic_id(i8* nocapture %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* getelementptr inbounds ([3 x [8 x i8]], [3 x [8 x i8]]* @snd_pcm_conf_generic_id.ids, i64 0, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* getelementptr inbounds ([3 x [8 x i8]], [3 x [8 x i8]]* @snd_pcm_conf_generic_id.ids, i64 0, i64 1, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* getelementptr inbounds ([3 x [8 x i8]], [3 x [8 x i8]]* @snd_pcm_conf_generic_id.ids, i64 0, i64 2, i64 0))
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ 1, %1 ], [ 1, %4 ], [ %10, %7 ]
ret i32 %12
}