#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
int /*<<< orphan*/ putc(unsigned char, int /*<<< orphan*/ *);
void emit_alias(FILE *out1, const char *alias, const char *c_name) {
  const char *s = alias;
  for (; *s; s++) {
    unsigned char c = *(unsigned char *)s;
    if (c >= 0x80)
      exit(1);
    if (c >= 'a' && c <= 'z')
      c -= 'a' - 'A';
    putc(c, out1);
  }
  fprintf(out1, ", ei_%s\n", c_name);
}


x86 assembly (clang, -O0):
<emit_alias>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     11bf <emit_alias+0x8f>
mov    -0x20(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
movzbl -0x21(%rbp),%eax
cmp    $0x80,%eax
jl     117b <emit_alias+0x4b>
mov    $0x1,%edi
call   1050 <exit@plt>
movzbl -0x21(%rbp),%eax
cmp    $0x61,%eax
jl     119f <emit_alias+0x6f>
movzbl -0x21(%rbp),%eax
cmp    $0x7a,%eax
jg     119f <emit_alias+0x6f>
movzbl -0x21(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
mov    -0x8(%rbp),%rsi
movzbl %al,%edi
call   1030 <putc@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    114c <emit_alias+0x1c>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe32(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_alias>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rdi,%r15
mov    (%rsi),%al
test   %al,%al
je     117c <emit_alias+0x4c>
mov    %rsi,%rbx
add    $0x1,%rbx
nopl   0x0(%rax,%rax,1)
test   %al,%al
js     1193 <emit_alias+0x63>
lea    -0x61(%rax),%ecx
lea    -0x20(%rax),%edx
cmp    $0x1a,%cl
movzbl %al,%eax
movzbl %dl,%ecx
cmovae %eax,%ecx
movzbl %cl,%edi
mov    %r15,%rsi
call   1030 <putc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1150 <emit_alias+0x20>
lea    0xe7d(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c", ei_%s\0A\00"
define void @emit_alias(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %5
store i8* %9, i8** %7
br label %10
10: ; preds = %39, %3
%11 = load i8*, i8** %7
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %42
14: ; preds = %10
%15 = load i8*, i8** %7
%16 = load i8, i8* %15
store i8 %16, i8* %8
%17 = load i8, i8* %8
%18 = zext i8 %17 to i32
%19 = icmp sge i32 %18, 128
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %14
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = icmp sge i32 %24, 97
br i1 %25, label %26, label %35
26: ; preds = %22
%27 = load i8, i8* %8
%28 = zext i8 %27 to i32
%29 = icmp sle i32 %28, 122
br i1 %29, label %30, label %35
30: ; preds = %26
%31 = load i8, i8* %8
%32 = zext i8 %31 to i32
%33 = sub nsw i32 %32, 32
%34 = trunc i32 %33 to i8
store i8 %34, i8* %8
br label %35
35: ; preds = %30, %26, %22
%36 = load i8, i8* %8
%37 = load i32*, i32** %4
%38 = call i32 @putc(i8 zeroext %36, i32* %37)
br label %39
39: ; preds = %35
%40 = load i8*, i8** %7
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %7
br label %10
42: ; preds = %10
%43 = load i32*, i32** %4
%44 = load i8*, i8** %6
%45 = call i32 @fprintf(i32* %43, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %44)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c", ei_%s\0A\00"
define void @emit_alias(i32* nocapture %0, i8* nocapture %1, i8* %2) {
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %21, label %6
6: ; preds = %3, %12
%7 = phi i8 [ %19, %12 ], [ %4, %3 ]
%8 = phi i8* [ %18, %12 ], [ %1, %3 ]
%9 = icmp slt i8 %7, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %6
%13 = add nsw i8 %7, -97
%14 = icmp ult i8 %13, 26
%15 = add nsw i8 %7, -32
%16 = select i1 %14, i8 %15, i8 %7
%17 = tail call i32 @putc(i8 zeroext %16, i32* %0)
%18 = getelementptr inbounds i8, i8* %8, i64 1
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %6
21: ; preds = %12, %3
%22 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}