#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*/ printf(char *, ...);
char fiorentina(char c, char prev_char, int print) {
  if (c == 'c' && prev_char == ' ') {
    if (print)
      printf("h");
    return 'h';
  } else if (c == 'C' && prev_char == ' ') {
    if (print)
      printf("H");
    return 'H';
  } else {
    if (print)
      printf("%c", c);
    return c;
  }
}


x86 assembly (clang, -O0):
<fiorentina>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    %edx,-0x8(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x63,%eax
jne    1162 <fiorentina+0x52>
movsbl -0x3(%rbp),%eax
cmp    $0x20,%eax
jne    1162 <fiorentina+0x52>
cmpl   $0x0,-0x8(%rbp)
je     1159 <fiorentina+0x49>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x68,-0x1(%rbp)
jmp    11bf <fiorentina+0xaf>
movsbl -0x2(%rbp),%eax
cmp    $0x43,%eax
jne    119d <fiorentina+0x8d>
movsbl -0x3(%rbp),%eax
cmp    $0x20,%eax
jne    119d <fiorentina+0x8d>
cmpl   $0x0,-0x8(%rbp)
je     1194 <fiorentina+0x84>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x48,-0x1(%rbp)
jmp    11bf <fiorentina+0xaf>
cmpl   $0x0,-0x8(%rbp)
je     11b9 <fiorentina+0xa9>
movsbl -0x2(%rbp),%esi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fiorentina>:
push   %rbx
mov    %edi,%eax
cmp    $0x63,%al
jne    112a <fiorentina+0x1a>
cmp    $0x20,%sil
jne    112a <fiorentina+0x1a>
mov    $0x68,%edi
mov    $0x68,%bl
test   %edx,%edx
jne    1148 <fiorentina+0x38>
jmp    114d <fiorentina+0x3d>
xor    $0x20,%sil
movsbl %al,%edi
movzbl %al,%ebx
xor    $0x43,%al
or     %sil,%al
mov    $0x48,%eax
cmove  %eax,%ebx
cmove  %eax,%edi
test   %edx,%edx
je     114d <fiorentina+0x3d>
call   1030 <putchar@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"h\00"
@.str.1 = [2 x i8] c"H\00"
@.str.2 = [3 x i8] c"%c\00"
define signext i8 @fiorentina(i8 signext %0, i8 signext %1, i32 %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i32
store i8 %0, i8* %5
store i8 %1, i8* %6
store i32 %2, i32* %7
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 99
br i1 %10, label %11, label %21
11: ; preds = %3
%12 = load i8, i8* %6
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 32
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = load i32, i32* %7
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
store i8 104, i8* %4
br label %44
21: ; preds = %11, %3
%22 = load i8, i8* %5
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 67
br i1 %24, label %25, label %35
25: ; preds = %21
%26 = load i8, i8* %6
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 32
br i1 %28, label %29, label %35
29: ; preds = %25
%30 = load i32, i32* %7
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %32, %29
store i8 72, i8* %4
br label %44
35: ; preds = %25, %21
%36 = load i32, i32* %7
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %35
%39 = load i8, i8* %5
%40 = sext i8 %39 to i32
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %38, %35
%43 = load i8, i8* %5
store i8 %43, i8* %4
br label %44
44: ; preds = %42, %34, %20
%45 = load i8, i8* %4
ret i8 %45
}

LLVM IR (-O2):
define signext i8 @fiorentina(i8 signext %0, i8 signext %1, i32 %2) {
%4 = icmp eq i8 %0, 99
%5 = icmp eq i8 %1, 32
%6 = and i1 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = icmp eq i32 %2, 0
br i1 %8, label %20, label %16
9: ; preds = %3
%10 = sext i8 %0 to i32
%11 = icmp eq i8 %0, 67
%12 = and i1 %11, %5
%13 = icmp eq i32 %2, 0
%14 = select i1 %12, i8 72, i8 %0
%15 = select i1 %12, i32 72, i32 %10
br i1 %13, label %20, label %16
16: ; preds = %9, %7
%17 = phi i32 [ 104, %7 ], [ %15, %9 ]
%18 = phi i8 [ 104, %7 ], [ %14, %9 ]
%19 = tail call i32 @putchar(i32 %17)
br label %20
20: ; preds = %9, %16, %7
%21 = phi i8 [ 104, %7 ], [ %18, %16 ], [ %14, %9 ]
ret i8 %21
}