#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__ isConsonant(char);
int /*<<< orphan*/ printf(char *, char *);
unsigned long strlen(char *);
void oldStyleAbbreviation(char *s) {
  char lastCh, d[10];
  unsigned long len;
  len = strlen(s);
  lastCh = s[len - 1];
  if (!isConsonant(s[0])) {
    d[0] = s[0];
    d[1] = lastCh;
    d[2] = '.';
    d[3] = '\0';
  } else {
    d[0] = s[0];
    if (isConsonant(s[1])) {
      d[1] = s[1];
      d[2] = lastCh;
      d[3] = '.';
      d[4] = '\0';
    } else {
      d[1] = lastCh;
      d[2] = '.';
      d[3] = '\0';
    }
  }
  printf("%s\n", d);
}


x86 assembly (clang, -O0):
<oldStyleAbbreviation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isConsonant@plt>
cmp    $0x0,%rax
jne    118d <oldStyleAbbreviation+0x5d>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x13(%rbp)
mov    -0x9(%rbp),%al
mov    %al,-0x12(%rbp)
movb   $0x2e,-0x11(%rbp)
movb   $0x0,-0x10(%rbp)
jmp    11dd <oldStyleAbbreviation+0xad>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x13(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1040 <isConsonant@plt>
cmp    $0x0,%rax
je     11ca <oldStyleAbbreviation+0x9a>
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x12(%rbp)
mov    -0x9(%rbp),%al
mov    %al,-0x11(%rbp)
movb   $0x2e,-0x10(%rbp)
movb   $0x0,-0xf(%rbp)
jmp    11d8 <oldStyleAbbreviation+0xa8>
mov    -0x9(%rbp),%al
mov    %al,-0x12(%rbp)
movb   $0x2e,-0x11(%rbp)
movb   $0x0,-0x10(%rbp)
jmp    11dd <oldStyleAbbreviation+0xad>
lea    -0x13(%rbp),%rsi
lea    0xe18(%rip),%rdi
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oldStyleAbbreviation>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    -0x1(%rax,%rbx,1),%r14b
movsbl (%rbx),%edi
call   1040 <isConsonant@plt>
mov    (%rbx),%cl
mov    %cl,0x6(%rsp)
mov    $0x3,%r15d
mov    $0x2,%r12d
mov    $0x1,%ebp
test   %rax,%rax
je     1193 <oldStyleAbbreviation+0x63>
movsbl 0x1(%rbx),%edi
call   1040 <isConsonant@plt>
test   %rax,%rax
je     1193 <oldStyleAbbreviation+0x63>
mov    0x1(%rbx),%al
mov    %al,0x7(%rsp)
mov    $0x4,%r15d
mov    $0x3,%r12d
mov    $0x2,%ebp
mov    %r14b,0x6(%rsp,%rbp,1)
movb   $0x2e,0x6(%rsp,%r12,1)
movb   $0x0,0x6(%rsp,%r15,1)
lea    0xe55(%rip),%rdi
lea    0x6(%rsp),%rsi
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @oldStyleAbbreviation(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca [10 x i8]
%5 = alloca i64
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i64 @strlen(i8* %6)
store i64 %7, i64* %5
%8 = load i8*, i8** %2
%9 = load i64, i64* %5
%10 = sub i64 %9, 1
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
store i8 %12, i8* %3
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = call i64 @isConsonant(i8 signext %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %27, label %18
18: ; preds = %1
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
store i8 %21, i8* %22
%23 = load i8, i8* %3
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 1
store i8 %23, i8* %24
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 2
store i8 46, i8* %25
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 3
store i8 0, i8* %26
br label %52
27: ; preds = %1
%28 = load i8*, i8** %2
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = load i8, i8* %29
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
store i8 %30, i8* %31
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i64 1
%34 = load i8, i8* %33
%35 = call i64 @isConsonant(i8 signext %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %46
37: ; preds = %27
%38 = load i8*, i8** %2
%39 = getelementptr inbounds i8, i8* %38, i64 1
%40 = load i8, i8* %39
%41 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 1
store i8 %40, i8* %41
%42 = load i8, i8* %3
%43 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 2
store i8 %42, i8* %43
%44 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 3
store i8 46, i8* %44
%45 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 4
store i8 0, i8* %45
br label %51
46: ; preds = %27
%47 = load i8, i8* %3
%48 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 1
store i8 %47, i8* %48
%49 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 2
store i8 46, i8* %49
%50 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 3
store i8 0, i8* %50
br label %51
51: ; preds = %46, %37
br label %52
52: ; preds = %51, %18
%53 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%54 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %53)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @oldStyleAbbreviation(i8* nocapture %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = add i64 %4, -1
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = load i8, i8* %0
%9 = tail call i64 @isConsonant(i8 signext %8)
%10 = icmp eq i64 %9, 0
%11 = load i8, i8* %0
store i8 %11, i8* %3
br i1 %10, label %20, label %12
12: ; preds = %1
%13 = getelementptr inbounds i8, i8* %0, i64 1
%14 = load i8, i8* %13
%15 = tail call i64 @isConsonant(i8 signext %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %12
%18 = load i8, i8* %13
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 1
store i8 %18, i8* %19
br label %20
20: ; preds = %12, %1, %17
%21 = phi i64 [ 2, %17 ], [ 1, %1 ], [ 1, %12 ]
%22 = phi i64 [ 3, %17 ], [ 2, %1 ], [ 2, %12 ]
%23 = phi i64 [ 4, %17 ], [ 3, %1 ], [ 3, %12 ]
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %21
store i8 %7, i8* %24
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %22
store i8 46, i8* %25
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %23
store i8 0, i8* %26
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}