#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*/ write_float();
int /*<<< orphan*/ write_zero();
void write_to_unit(char unit) {
  int i;
  for (i = 0; i < 5; i++) {
    unit == 'A' + i || unit == 'a' + i ? write_zero() : write_float();
  }
}


x86 assembly (clang, -O0):
<write_to_unit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1184 <write_to_unit+0x64>
movsbl -0x1(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x41,%ecx
cmp    %ecx,%eax
je     1163 <write_to_unit+0x43>
movsbl -0x1(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x61,%ecx
cmp    %ecx,%eax
jne    116f <write_to_unit+0x4f>
mov    $0x0,%al
call   1030 <write_zero@plt>
jmp    1176 <write_to_unit+0x56>
mov    $0x0,%al
call   1040 <write_float@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1135 <write_to_unit+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_to_unit>:
push   %rbx
mov    %edi,%ebx
and    $0xdf,%bl
xor    %eax,%eax
cmp    $0x41,%bl
jne    1134 <write_to_unit+0x14>
call   1030 <write_zero@plt>
jmp    1139 <write_to_unit+0x19>
call   1040 <write_float@plt>
xor    %eax,%eax
cmp    $0x42,%bl
jne    1147 <write_to_unit+0x27>
call   1030 <write_zero@plt>
jmp    114c <write_to_unit+0x2c>
call   1040 <write_float@plt>
xor    %eax,%eax
cmp    $0x43,%bl
jne    115a <write_to_unit+0x3a>
call   1030 <write_zero@plt>
jmp    115f <write_to_unit+0x3f>
call   1040 <write_float@plt>
xor    %eax,%eax
cmp    $0x44,%bl
jne    116d <write_to_unit+0x4d>
call   1030 <write_zero@plt>
jmp    1172 <write_to_unit+0x52>
call   1040 <write_float@plt>
xor    %eax,%eax
cmp    $0x45,%bl
jne    117f <write_to_unit+0x5f>
pop    %rbx
jmp    1030 <write_zero@plt>
pop    %rbx
jmp    1040 <write_float@plt>

LLVM IR (-O0):
define void @write_to_unit(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
br label %4
4: ; preds = %25, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %28
7: ; preds = %4
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = load i32, i32* %3
%11 = add nsw i32 65, %10
%12 = icmp eq i32 %9, %11
br i1 %12, label %19, label %13
13: ; preds = %7
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = load i32, i32* %3
%17 = add nsw i32 97, %16
%18 = icmp eq i32 %15, %17
br i1 %18, label %19, label %21
19: ; preds = %13, %7
%20 = call i32 (...) @write_zero()
br label %23
21: ; preds = %13
%22 = call i32 (...) @write_float()
br label %23
23: ; preds = %21, %19
%24 = phi i32 [ %20, %19 ], [ %22, %21 ]
br label %25
25: ; preds = %23
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %4
28: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @write_to_unit(i8 signext %0) {
%2 = and i8 %0, -33
%3 = icmp eq i8 %2, 65
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @write_zero()
br label %8
6: ; preds = %1
%7 = tail call i32 (...) @write_float()
br label %8
8: ; preds = %4, %6
%9 = and i8 %0, -33
%10 = icmp eq i8 %9, 66
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 (...) @write_float()
br label %15
13: ; preds = %8
%14 = tail call i32 (...) @write_zero()
br label %15
15: ; preds = %13, %11
%16 = and i8 %0, -33
%17 = icmp eq i8 %16, 67
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 (...) @write_float()
br label %22
20: ; preds = %15
%21 = tail call i32 (...) @write_zero()
br label %22
22: ; preds = %20, %18
%23 = and i8 %0, -33
%24 = icmp eq i8 %23, 68
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call i32 (...) @write_float()
br label %29
27: ; preds = %22
%28 = tail call i32 (...) @write_zero()
br label %29
29: ; preds = %27, %25
%30 = and i8 %0, -33
%31 = icmp eq i8 %30, 69
br i1 %31, label %34, label %32
32: ; preds = %29
%33 = tail call i32 (...) @write_float()
br label %36
34: ; preds = %29
%35 = tail call i32 (...) @write_zero()
br label %36
36: ; preds = %34, %32
ret void
}