#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 */
struct shf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ shf_putchar(int, struct shf *);
void tputC(int c, struct shf *shf) {
  if ((c & 0x60) == 0) {
    shf_putchar((c & 0x80) ? '$' : '^', shf);
    ;
    shf_putchar(((c & 0x7F) | 0x40), shf);
    ;
  } else if ((c & 0x7F) == 0x7F) {
    shf_putchar((c & 0x80) ? '$' : '^', shf);
    ;
    shf_putchar('?', shf);
    ;
  } else
    shf_putchar(c, shf);
  ;
}


x86 assembly (clang, -O0):
<tputC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x60,%eax
cmp    $0x0,%eax
jne    1167 <tputC+0x57>
mov    -0x4(%rbp),%ecx
and    $0x80,%ecx
mov    $0x5e,%edi
mov    $0x24,%eax
cmp    $0x0,%ecx
cmovne %eax,%edi
mov    -0x10(%rbp),%rsi
call   1030 <shf_putchar@plt>
mov    -0x4(%rbp),%edi
and    $0x7f,%edi
or     $0x40,%edi
mov    -0x10(%rbp),%rsi
call   1030 <shf_putchar@plt>
jmp    11bc <tputC+0xac>
mov    -0x4(%rbp),%eax
and    $0x7f,%eax
cmp    $0x7f,%eax
jne    11ab <tputC+0x9b>
mov    -0x4(%rbp),%ecx
and    $0x80,%ecx
mov    $0x5e,%edi
mov    $0x24,%eax
cmp    $0x0,%ecx
cmovne %eax,%edi
mov    -0x10(%rbp),%rsi
call   1030 <shf_putchar@plt>
mov    -0x10(%rbp),%rsi
mov    $0x3f,%edi
call   1030 <shf_putchar@plt>
jmp    11b7 <tputC+0xa7>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <shf_putchar@plt>
jmp    11bc <tputC+0xac>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tputC>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
test   $0x60,%bpl
je     1146 <tputC+0x36>
mov    %ebp,%eax
not    %eax
test   $0x7f,%al
jne    1165 <tputC+0x55>
test   $0x80,%bpl
mov    $0x5e,%eax
mov    $0x24,%edi
cmove  %eax,%edi
mov    %rbx,%rsi
call   1030 <shf_putchar@plt>
mov    $0x3f,%ebp
jmp    1165 <tputC+0x55>
test   $0x80,%bpl
mov    $0x5e,%eax
mov    $0x24,%edi
cmove  %eax,%edi
mov    %rbx,%rsi
call   1030 <shf_putchar@plt>
and    $0x3f,%ebp
or     $0x40,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <shf_putchar@plt>

LLVM IR (-O0):
%struct.shf = type { i32 }
define void @tputC(i32 %0, %struct.shf* %1) {
%3 = alloca i32
%4 = alloca %struct.shf*
store i32 %0, i32* %3
store %struct.shf* %1, %struct.shf** %4
%5 = load i32, i32* %3
%6 = and i32 %5, 96
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %2
%9 = load i32, i32* %3
%10 = and i32 %9, 128
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 36, i32 94
%14 = load %struct.shf*, %struct.shf** %4
%15 = call i32 @shf_putchar(i32 %13, %struct.shf* %14)
%16 = load i32, i32* %3
%17 = and i32 %16, 127
%18 = or i32 %17, 64
%19 = load %struct.shf*, %struct.shf** %4
%20 = call i32 @shf_putchar(i32 %18, %struct.shf* %19)
br label %40
21: ; preds = %2
%22 = load i32, i32* %3
%23 = and i32 %22, 127
%24 = icmp eq i32 %23, 127
br i1 %24, label %25, label %35
25: ; preds = %21
%26 = load i32, i32* %3
%27 = and i32 %26, 128
%28 = icmp ne i32 %27, 0
%29 = zext i1 %28 to i64
%30 = select i1 %28, i32 36, i32 94
%31 = load %struct.shf*, %struct.shf** %4
%32 = call i32 @shf_putchar(i32 %30, %struct.shf* %31)
%33 = load %struct.shf*, %struct.shf** %4
%34 = call i32 @shf_putchar(i32 63, %struct.shf* %33)
br label %39
35: ; preds = %21
%36 = load i32, i32* %3
%37 = load %struct.shf*, %struct.shf** %4
%38 = call i32 @shf_putchar(i32 %36, %struct.shf* %37)
br label %39
39: ; preds = %35, %25
br label %40
40: ; preds = %39, %8
ret void
}

LLVM IR (-O2):
%struct.shf = type { i32 }
define void @tputC(i32 %0, %struct.shf* %1) {
%3 = and i32 %0, 96
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = and i32 %0, 128
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i32 94, i32 36
%9 = tail call i32 @shf_putchar(i32 %8, %struct.shf* %1)
%10 = and i32 %0, 63
%11 = or i32 %10, 64
br label %20
12: ; preds = %2
%13 = and i32 %0, 127
%14 = icmp eq i32 %13, 127
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = and i32 %0, 128
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i32 94, i32 36
%19 = tail call i32 @shf_putchar(i32 %18, %struct.shf* %1)
br label %20
20: ; preds = %12, %15, %5
%21 = phi i32 [ 63, %15 ], [ %11, %5 ], [ %0, %12 ]
%22 = tail call i32 @shf_putchar(i32 %21, %struct.shf* %1)
ret void
}