#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*/ strncpy(char *, char *, int);
int tolower(char const);
void infer_article(const char *word, char *buf) {
  switch (tolower(word[0])) {
  case 'a':
  case 'e':
  case 'i':
  case 'o':
  case 'u':
    strncpy(buf, "an", 3);
    break;
  default:
    strncpy(buf, "a", 2);
  }
}


x86 assembly (clang, -O0):
<infer_article>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <tolower@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
sub    $0x61,%eax
je     1193 <infer_article+0x73>
jmp    114f <infer_article+0x2f>
mov    -0x14(%rbp),%eax
sub    $0x65,%eax
je     1193 <infer_article+0x73>
jmp    1160 <infer_article+0x40>
mov    -0x14(%rbp),%eax
sub    $0x69,%eax
je     1193 <infer_article+0x73>
jmp    1171 <infer_article+0x51>
mov    -0x14(%rbp),%eax
sub    $0x6f,%eax
je     1193 <infer_article+0x73>
jmp    1182 <infer_article+0x62>
mov    -0x14(%rbp),%eax
sub    $0x75,%eax
jne    11ad <infer_article+0x8d>
jmp    1193 <infer_article+0x73>
mov    -0x10(%rbp),%rdi
lea    0xe62(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncpy@plt>
jmp    11c2 <infer_article+0xa2>
mov    -0x10(%rbp),%rdi
lea    0xe4b(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<infer_article>:
push   %rbx
mov    %rsi,%rbx
movsbl (%rdi),%edi
call   1040 <tolower@plt>
add    $0xffffff9f,%eax
ror    %eax
cmp    $0xa,%eax
ja     1155 <infer_article+0x35>
mov    $0x495,%ecx
bt     %eax,%ecx
jae    1155 <infer_article+0x35>
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
pop    %rbx
jmp    1030 <strncpy@plt>
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
pop    %rbx
jmp    1030 <strncpy@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"an\00"
@.str.1 = [2 x i8] c"a\00"
define void @infer_article(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = call i32 @tolower(i8 signext %7)
switch i32 %8, label %12 [
i32 97, label %9
i32 101, label %9
i32 105, label %9
i32 111, label %9
i32 117, label %9
]
9: ; preds = %2, %2, %2, %2, %2
%10 = load i8*, i8** %4
%11 = call i32 @strncpy(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 3)
br label %15
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call i32 @strncpy(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 2)
br label %15
15: ; preds = %12, %9
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"an\00"
@.str.1 = [2 x i8] c"a\00"
define void @infer_article(i8* nocapture %0, i8* %1) {
%3 = load i8, i8* %0
%4 = tail call i32 @tolower(i8 signext %3)
%5 = add i32 %4, -97
%6 = tail call i32 @llvm.fshl.i32(i32 %5, i32 %5, i32 31)
switch i32 %6, label %9 [
i32 0, label %7
i32 2, label %7
i32 4, label %7
i32 7, label %7
i32 10, label %7
]
7: ; preds = %2, %2, %2, %2, %2
%8 = tail call i32 @strncpy(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 3)
br label %11
9: ; preds = %2
%10 = tail call i32 @strncpy(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 2)
br label %11
11: ; preds = %9, %7
ret void
}