int test_trim_char(void) {
  do {
    if (!(trim_char('\n') == 1)) {
      printf("%sERROR!%s [%s:%d] %s %sFAILED!%s\n", "\x1B[1;31m", "\x1B[1;0m",
             __func__, 130, "trim_char('\\n') == 1", "\x1B[1;31m", "\x1B[1;0m");
      return -1;
    }
  } while (0);
  do {
    if (!(trim_char('\t') == 1)) {
      printf("%sERROR!%s [%s:%d] %s %sFAILED!%s\n", "\x1B[1;31m", "\x1B[1;0m",
             __func__, 131, "trim_char('\\t') == 1", "\x1B[1;31m", "\x1B[1;0m");
      return -1;
    }
  } while (0);
  do {
    if (!(trim_char('\r') == 1)) {
      printf("%sERROR!%s [%s:%d] %s %sFAILED!%s\n", "\x1B[1;31m", "\x1B[1;0m",
             __func__, 132, "trim_char('\\r') == 1", "\x1B[1;31m", "\x1B[1;0m");
      return -1;
    }
  } while (0);
  do {
    if (!(trim_char(' ') == 1)) {
      printf("%sERROR!%s [%s:%d] %s %sFAILED!%s\n", "\x1B[1;31m", "\x1B[1;0m",
             __func__, 133, "trim_char(' ') == 1", "\x1B[1;31m", "\x1B[1;0m");
      return -1;
    }
  } while (0);
  do {
    if (!(trim_char('A') == 0)) {
      printf("%sERROR!%s [%s:%d] %s %sFAILED!%s\n", "\x1B[1;31m", "\x1B[1;0m",
             __func__, 134, "trim_char('A') == 0", "\x1B[1;31m", "\x1B[1;0m");
      return -1;
    }
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_trim_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0xa,%edi
mov    $0x0,%al
call   1040 <trim_char@plt>
cmp    $0x1,%eax
je     1188 <test_trim_char+0x68>
lea    0xebc(%rip),%rdi
lea    0xed8(%rip),%r10
lea    0xed9(%rip),%rax
lea    0xed9(%rip),%rcx
mov    $0x82,%r8d
lea    0xedb(%rip),%r9
mov    %r10,%rsi
mov    %rax,%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    133c <test_trim_char+0x21c>
jmp    118d <test_trim_char+0x6d>
jmp    1192 <test_trim_char+0x72>
mov    $0x9,%edi
mov    $0x0,%al
call   1040 <trim_char@plt>
cmp    $0x1,%eax
je     11f2 <test_trim_char+0xd2>
lea    0xe52(%rip),%rdi
lea    0xe6e(%rip),%r10
lea    0xe6f(%rip),%rax
lea    0xe6f(%rip),%rcx
mov    $0x83,%r8d
lea    0xe86(%rip),%r9
mov    %r10,%rsi
mov    %rax,%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    133c <test_trim_char+0x21c>
jmp    11f7 <test_trim_char+0xd7>
jmp    11fc <test_trim_char+0xdc>
mov    $0xd,%edi
mov    $0x0,%al
call   1040 <trim_char@plt>
cmp    $0x1,%eax
je     125c <test_trim_char+0x13c>
lea    0xde8(%rip),%rdi
lea    0xe04(%rip),%r10
lea    0xe05(%rip),%rax
lea    0xe05(%rip),%rcx
mov    $0x84,%r8d
lea    0xe31(%rip),%r9
mov    %r10,%rsi
mov    %rax,%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    133c <test_trim_char+0x21c>
jmp    1261 <test_trim_char+0x141>
jmp    1266 <test_trim_char+0x146>
mov    $0x20,%edi
mov    $0x0,%al
call   1040 <trim_char@plt>
cmp    $0x1,%eax
je     12c6 <test_trim_char+0x1a6>
lea    0xd7e(%rip),%rdi
lea    0xd9a(%rip),%r10
lea    0xd9b(%rip),%rax
lea    0xd9b(%rip),%rcx
mov    $0x85,%r8d
lea    0xddc(%rip),%r9
mov    %r10,%rsi
mov    %rax,%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    133c <test_trim_char+0x21c>
jmp    12cb <test_trim_char+0x1ab>
jmp    12d0 <test_trim_char+0x1b0>
mov    $0x41,%edi
mov    $0x0,%al
call   1040 <trim_char@plt>
cmp    $0x0,%eax
je     1330 <test_trim_char+0x210>
lea    0xd14(%rip),%rdi
lea    0xd30(%rip),%r10
lea    0xd31(%rip),%rax
lea    0xd31(%rip),%rcx
mov    $0x86,%r8d
lea    0xd86(%rip),%r9
mov    %r10,%rsi
mov    %rax,%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    133c <test_trim_char+0x21c>
jmp    1335 <test_trim_char+0x215>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_trim_char>:
push   %rbx
mov    $0xa,%edi
xor    %eax,%eax
call   1040 <trim_char@plt>
cmp    $0x1,%eax
jne    11b9 <test_trim_char+0x99>
mov    $0x9,%edi
xor    %eax,%eax
call   1040 <trim_char@plt>
cmp    $0x1,%eax
jne    11e4 <test_trim_char+0xc4>
mov    $0xd,%edi
xor    %eax,%eax
call   1040 <trim_char@plt>
cmp    $0x1,%eax
jne    120f <test_trim_char+0xef>
xor    %ebx,%ebx
mov    $0x20,%edi
xor    %eax,%eax
call   1040 <trim_char@plt>
cmp    $0x1,%eax
jne    123a <test_trim_char+0x11a>
mov    $0x41,%edi
xor    %eax,%eax
call   1040 <trim_char@plt>
test   %eax,%eax
je     1275 <test_trim_char+0x155>
lea    0xe99(%rip),%rdx
lea    0xe8a(%rip),%rsi
lea    0xe60(%rip),%rdi
lea    0xe8b(%rip),%rcx
lea    0xee6(%rip),%r9
mov    $0x86,%r8d
jmp    1263 <test_trim_char+0x143>
lea    0xe6b(%rip),%rdx
lea    0xe5c(%rip),%rsi
lea    0xe32(%rip),%rdi
lea    0xe5d(%rip),%rcx
lea    0xe65(%rip),%r9
mov    $0x82,%r8d
jmp    1263 <test_trim_char+0x143>
lea    0xe40(%rip),%rdx
lea    0xe31(%rip),%rsi
lea    0xe07(%rip),%rdi
lea    0xe32(%rip),%rcx
lea    0xe4f(%rip),%r9
mov    $0x83,%r8d
jmp    1263 <test_trim_char+0x143>
lea    0xe15(%rip),%rdx
lea    0xe06(%rip),%rsi
lea    0xddc(%rip),%rdi
lea    0xe07(%rip),%rcx
lea    0xe39(%rip),%r9
mov    $0x84,%r8d
jmp    1263 <test_trim_char+0x143>
lea    0xdea(%rip),%rdx
lea    0xddb(%rip),%rsi
lea    0xdb1(%rip),%rdi
lea    0xddc(%rip),%rcx
lea    0xe23(%rip),%r9
mov    $0x85,%r8d
xor    %eax,%eax
push   %rdx
push   %rsi
call   1030 <printf@plt>
add    $0x10,%rsp
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"%sERROR!%s [%s:%d] %s %sFAILED!%s\0A\00"
@.str.1 = [8 x i8] c"\1B[1;31m\00"
@.str.2 = [7 x i8] c"\1B[1;0m\00"
@__func__.test_trim_char = [15 x i8] c"test_trim_char\00"
@.str.3 = [21 x i8] c"trim_char('\\n') == 1\00"
@.str.4 = [21 x i8] c"trim_char('\\t') == 1\00"
@.str.5 = [21 x i8] c"trim_char('\\r') == 1\00"
@.str.6 = [20 x i8] c"trim_char(' ') == 1\00"
@.str.7 = [20 x i8] c"trim_char('A') == 0\00"
define i32 @test_trim_char() {
%1 = alloca i32
br label %2
2: ; preds = %0
%3 = call i32 (i32, ...) bitcast (i32 (...)* @trim_char to i32 (i32, ...)*)(i32 10)
%4 = icmp eq i32 %3, 1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_trim_char, i64 0, i64 0), i32 130, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %37
7: ; preds = %2
br label %8
8: ; preds = %7
br label %9
9: ; preds = %8
%10 = call i32 (i32, ...) bitcast (i32 (...)* @trim_char to i32 (i32, ...)*)(i32 9)
%11 = icmp eq i32 %10, 1
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_trim_char, i64 0, i64 0), i32 131, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %37
14: ; preds = %9
br label %15
15: ; preds = %14
br label %16
16: ; preds = %15
%17 = call i32 (i32, ...) bitcast (i32 (...)* @trim_char to i32 (i32, ...)*)(i32 13)
%18 = icmp eq i32 %17, 1
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_trim_char, i64 0, i64 0), i32 132, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %37
21: ; preds = %16
br label %22
22: ; preds = %21
br label %23
23: ; preds = %22
%24 = call i32 (i32, ...) bitcast (i32 (...)* @trim_char to i32 (i32, ...)*)(i32 32)
%25 = icmp eq i32 %24, 1
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_trim_char, i64 0, i64 0), i32 133, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %37
28: ; preds = %23
br label %29
29: ; preds = %28
br label %30
30: ; preds = %29
%31 = call i32 (i32, ...) bitcast (i32 (...)* @trim_char to i32 (i32, ...)*)(i32 65)
%32 = icmp eq i32 %31, 0
br i1 %32, label %35, label %33
33: ; preds = %30
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_trim_char, i64 0, i64 0), i32 134, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %37
35: ; preds = %30
br label %36
36: ; preds = %35
store i32 0, i32* %1
br label %37
37: ; preds = %36, %33, %26, %19, %12, %5
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str = [35 x i8] c"%sERROR!%s [%s:%d] %s %sFAILED!%s\0A\00"
@.str.1 = [8 x i8] c"\1B[1;31m\00"
@.str.2 = [7 x i8] c"\1B[1;0m\00"
@__func__.test_trim_char = [15 x i8] c"test_trim_char\00"
@.str.3 = [21 x i8] c"trim_char('\\n') == 1\00"
@.str.4 = [21 x i8] c"trim_char('\\t') == 1\00"
@.str.5 = [21 x i8] c"trim_char('\\r') == 1\00"
@.str.6 = [20 x i8] c"trim_char(' ') == 1\00"
@.str.7 = [20 x i8] c"trim_char('A') == 0\00"
define i32 @test_trim_char() {
%1 = tail call i32 (i32, ...) bitcast (i32 (...)* @trim_char to i32 (i32, ...)*)(i32 10)
%2 = icmp eq i32 %1, 1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_trim_char, i64 0, i64 0), i32 130, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %25
5: ; preds = %0
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @trim_char to i32 (i32, ...)*)(i32 9)
%7 = icmp eq i32 %6, 1
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_trim_char, i64 0, i64 0), i32 131, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %25
10: ; preds = %5
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @trim_char to i32 (i32, ...)*)(i32 13)
%12 = icmp eq i32 %11, 1
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_trim_char, i64 0, i64 0), i32 132, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %25
15: ; preds = %10
%16 = tail call i32 (i32, ...) bitcast (i32 (...)* @trim_char to i32 (i32, ...)*)(i32 32)
%17 = icmp eq i32 %16, 1
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_trim_char, i64 0, i64 0), i32 133, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %25
20: ; preds = %15
%21 = tail call i32 (i32, ...) bitcast (i32 (...)* @trim_char to i32 (i32, ...)*)(i32 65)
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_trim_char, i64 0, i64 0), i32 134, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %20, %23, %18, %13, %8, %3
%26 = phi i32 [ -1, %23 ], [ -1, %18 ], [ -1, %13 ], [ -1, %8 ], [ -1, %3 ], [ 0, %20 ]
ret i32 %26
}