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

/* Variables and functions */
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
scalar_t__ strcmp(char *, char *);
void dcr_asm(char *reg, FILE *file) {
  unsigned char buffer[] = {0};
  if (strcmp(reg, "b") == 0)
    buffer[0] = 0x05;
  else if (strcmp(reg, "c") == 0)
    buffer[0] = 0x0d;
  else if (strcmp(reg, "d") == 0)
    buffer[0] = 0x15;
  else if (strcmp(reg, "e") == 0)
    buffer[0] = 0x1d;
  else if (strcmp(reg, "h") == 0)
    buffer[0] = 0x25;
  else if (strcmp(reg, "l") == 0)
    buffer[0] = 0x2d;
  else if (strcmp(reg, "m") == 0)
    buffer[0] = 0x35;
  else if (strcmp(reg, "a") == 0)
    buffer[0] = 0x3d;
  fwrite(buffer, sizeof(buffer), 1, file);
}


x86 assembly (clang, -O0):
<dcr_asm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x11(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1173 <dcr_asm+0x43>
movb   $0x5,-0x11(%rbp)
jmp    1286 <dcr_asm+0x156>
mov    -0x8(%rbp),%rdi
lea    0xe84(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1196 <dcr_asm+0x66>
movb   $0xd,-0x11(%rbp)
jmp    1281 <dcr_asm+0x151>
mov    -0x8(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11b9 <dcr_asm+0x89>
movb   $0x15,-0x11(%rbp)
jmp    127c <dcr_asm+0x14c>
mov    -0x8(%rbp),%rdi
lea    0xe42(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11dc <dcr_asm+0xac>
movb   $0x1d,-0x11(%rbp)
jmp    1277 <dcr_asm+0x147>
mov    -0x8(%rbp),%rdi
lea    0xe21(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ff <dcr_asm+0xcf>
movb   $0x25,-0x11(%rbp)
jmp    1272 <dcr_asm+0x142>
mov    -0x8(%rbp),%rdi
lea    0xe00(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1222 <dcr_asm+0xf2>
movb   $0x2d,-0x11(%rbp)
jmp    126d <dcr_asm+0x13d>
mov    -0x8(%rbp),%rdi
lea    0xddf(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1245 <dcr_asm+0x115>
movb   $0x35,-0x11(%rbp)
jmp    1268 <dcr_asm+0x138>
mov    -0x8(%rbp),%rdi
lea    0xdbe(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1263 <dcr_asm+0x133>
movb   $0x3d,-0x11(%rbp)
jmp    1268 <dcr_asm+0x138>
jmp    126d <dcr_asm+0x13d>
jmp    1272 <dcr_asm+0x142>
jmp    1277 <dcr_asm+0x147>
jmp    127c <dcr_asm+0x14c>
jmp    1281 <dcr_asm+0x151>
jmp    1286 <dcr_asm+0x156>
lea    -0x11(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1050 <fwrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcr_asm>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11d9 <dcr_asm+0xb9>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11e0 <dcr_asm+0xc0>
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11e7 <dcr_asm+0xc7>
lea    0xe94(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11ee <dcr_asm+0xce>
lea    0xe82(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11f5 <dcr_asm+0xd5>
lea    0xe70(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11fc <dcr_asm+0xdc>
lea    0xe5e(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1203 <dcr_asm+0xe3>
lea    0xe4c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
mov    $0x3d,%edi
cmovne %ecx,%edi
jmp    1208 <dcr_asm+0xe8>
mov    $0x5,%edi
jmp    1208 <dcr_asm+0xe8>
mov    $0xd,%edi
jmp    1208 <dcr_asm+0xe8>
mov    $0x15,%edi
jmp    1208 <dcr_asm+0xe8>
mov    $0x1d,%edi
jmp    1208 <dcr_asm+0xe8>
mov    $0x25,%edi
jmp    1208 <dcr_asm+0xe8>
mov    $0x2d,%edi
jmp    1208 <dcr_asm+0xe8>
mov    $0x35,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"b\00"
@.str.1 = [2 x i8] c"c\00"
@.str.2 = [2 x i8] c"d\00"
@.str.3 = [2 x i8] c"e\00"
@.str.4 = [2 x i8] c"h\00"
@.str.5 = [2 x i8] c"l\00"
@.str.6 = [2 x i8] c"m\00"
@.str.7 = [2 x i8] c"a\00"
define void @dcr_asm(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca [1 x i8]
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = bitcast [1 x i8]* %5 to i8*
%7 = load i8*, i8** %3
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 5, i8* %11
br label %61
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 13, i8* %17
br label %60
18: ; preds = %12
%19 = load i8*, i8** %3
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 21, i8* %23
br label %59
24: ; preds = %18
%25 = load i8*, i8** %3
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 29, i8* %29
br label %58
30: ; preds = %24
%31 = load i8*, i8** %3
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 37, i8* %35
br label %57
36: ; preds = %30
%37 = load i8*, i8** %3
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 45, i8* %41
br label %56
42: ; preds = %36
%43 = load i8*, i8** %3
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 53, i8* %47
br label %55
48: ; preds = %42
%49 = load i8*, i8** %3
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 61, i8* %53
br label %54
54: ; preds = %52, %48
br label %55
55: ; preds = %54, %46
br label %56
56: ; preds = %55, %40
br label %57
57: ; preds = %56, %34
br label %58
58: ; preds = %57, %28
br label %59
59: ; preds = %58, %22
br label %60
60: ; preds = %59, %16
br label %61
61: ; preds = %60, %10
%62 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%63 = load i32*, i32** %4
%64 = call i32 @fwrite(i8* %62, i32 1, i32 1, i32* %63)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"b\00"
@.str.1 = [2 x i8] c"c\00"
@.str.2 = [2 x i8] c"d\00"
@.str.3 = [2 x i8] c"e\00"
@.str.4 = [2 x i8] c"h\00"
@.str.5 = [2 x i8] c"l\00"
@.str.6 = [2 x i8] c"m\00"
@.str.7 = [2 x i8] c"a\00"
define void @dcr_asm(i8* %0, i32* nocapture %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %27, label %5
5: ; preds = %2
%6 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %27, label %8
8: ; preds = %5
%9 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %27, label %11
11: ; preds = %8
%12 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %27, label %14
14: ; preds = %11
%15 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %27, label %17
17: ; preds = %14
%18 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %27, label %20
20: ; preds = %17
%21 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %20
%24 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
%26 = select i1 %25, i32 61, i32 0
br label %27
27: ; preds = %23, %20, %17, %14, %11, %8, %5, %2
%28 = phi i32 [ 5, %2 ], [ 13, %5 ], [ 21, %8 ], [ 29, %11 ], [ 37, %14 ], [ 45, %17 ], [ 53, %20 ], [ %26, %23 ]
%29 = tail call i32 @fputc(i32 %28, i32* %1)
ret void
}