#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*/ addch(unsigned char);
void putt(unsigned char c) {
  if ((c < 32) || (c >= 128 && c < 160))
    c += 32;
  else if ((c == 127) || (c == 255))
    c = '#';
  else if (c > 127 && c < 255)
    c -= 127;
  addch(c);
}


x86 assembly (clang, -O0):
<putt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x20,%eax
jl     1149 <putt+0x39>
movzbl -0x1(%rbp),%eax
cmp    $0x80,%eax
jl     1158 <putt+0x48>
movzbl -0x1(%rbp),%eax
cmp    $0xa0,%eax
jge    1158 <putt+0x48>
movzbl -0x1(%rbp),%eax
add    $0x20,%eax
mov    %al,-0x1(%rbp)
jmp    11ad <putt+0x9d>
movzbl -0x1(%rbp),%eax
cmp    $0x7f,%eax
je     1174 <putt+0x64>
movzbl -0x1(%rbp),%eax
cmp    $0xff,%eax
jne    117d <putt+0x6d>
movb   $0x23,-0x1(%rbp)
jmp    11a8 <putt+0x98>
movzbl -0x1(%rbp),%eax
cmp    $0x7f,%eax
jle    11a3 <putt+0x93>
movzbl -0x1(%rbp),%eax
cmp    $0xff,%eax
jge    11a3 <putt+0x93>
movzbl -0x1(%rbp),%eax
sub    $0x7f,%eax
mov    %al,-0x1(%rbp)
jmp    11a8 <putt+0x98>
jmp    11ad <putt+0x9d>
movzbl -0x1(%rbp),%edi
call   1030 <addch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putt>:
cmp    $0x20,%dil
jb     113f <putt+0x2f>
cmp    $0x9f,%dil
jle    113f <putt+0x2f>
mov    %edi,%ecx
not    %cl
mov    $0x23,%al
test   $0x7f,%cl
je     1137 <putt+0x27>
lea    -0x7f(%rdi),%eax
test   %dil,%dil
movzbl %dil,%ecx
movzbl %al,%eax
cmovns %ecx,%eax
movzbl %al,%edi
jmp    1030 <addch@plt>
add    $0x20,%dil
mov    %edi,%eax
movzbl %al,%edi
jmp    1030 <addch@plt>

LLVM IR (-O0):
define void @putt(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp slt i32 %4, 32
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = icmp sge i32 %8, 128
br i1 %9, label %10, label %19
10: ; preds = %6
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = icmp slt i32 %12, 160
br i1 %13, label %14, label %19
14: ; preds = %10, %1
%15 = load i8, i8* %2
%16 = zext i8 %15 to i32
%17 = add nsw i32 %16, 32
%18 = trunc i32 %17 to i8
store i8 %18, i8* %2
br label %43
19: ; preds = %10, %6
%20 = load i8, i8* %2
%21 = zext i8 %20 to i32
%22 = icmp eq i32 %21, 127
br i1 %22, label %27, label %23
23: ; preds = %19
%24 = load i8, i8* %2
%25 = zext i8 %24 to i32
%26 = icmp eq i32 %25, 255
br i1 %26, label %27, label %28
27: ; preds = %23, %19
store i8 35, i8* %2
br label %42
28: ; preds = %23
%29 = load i8, i8* %2
%30 = zext i8 %29 to i32
%31 = icmp sgt i32 %30, 127
br i1 %31, label %32, label %41
32: ; preds = %28
%33 = load i8, i8* %2
%34 = zext i8 %33 to i32
%35 = icmp slt i32 %34, 255
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = load i8, i8* %2
%38 = zext i8 %37 to i32
%39 = sub nsw i32 %38, 127
%40 = trunc i32 %39 to i8
store i8 %40, i8* %2
br label %41
41: ; preds = %36, %32, %28
br label %42
42: ; preds = %41, %27
br label %43
43: ; preds = %42, %14
%44 = load i8, i8* %2
%45 = call i32 @addch(i8 zeroext %44)
ret void
}

LLVM IR (-O2):
define void @putt(i8 zeroext %0) {
%2 = icmp ult i8 %0, 32
%3 = icmp slt i8 %0, -96
%4 = or i1 %2, %3
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = add nsw i8 %0, 32
br label %14
7: ; preds = %1
%8 = and i8 %0, 127
%9 = icmp eq i8 %8, 127
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = icmp slt i8 %0, 0
%12 = add i8 %0, -127
%13 = select i1 %11, i8 %12, i8 %0
br label %14
14: ; preds = %10, %7, %5
%15 = phi i8 [ %6, %5 ], [ 35, %7 ], [ %13, %10 ]
%16 = tail call i32 @addch(i8 zeroext %15)
ret void
}