#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
void filter(FILE *fp, const char *code) {
  for (; *code != '\0'; code++) {
    switch (*code) {
    case ' ':
      fputc('S', fp);
      break;
    case '\t':
      fputc('T', fp);
      break;
    case '\n':
      fputc('\n', fp);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<filter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11b4 <filter+0xa4>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x9,%eax
je     117d <filter+0x6d>
jmp    1148 <filter+0x38>
mov    -0x14(%rbp),%eax
sub    $0xa,%eax
je     1190 <filter+0x80>
jmp    1159 <filter+0x49>
mov    -0x14(%rbp),%eax
sub    $0x20,%eax
jne    119e <filter+0x8e>
jmp    116a <filter+0x5a>
mov    -0x8(%rbp),%rsi
mov    $0x53,%edi
call   1030 <fputc@plt>
jmp    119e <filter+0x8e>
mov    -0x8(%rbp),%rsi
mov    $0x54,%edi
call   1030 <fputc@plt>
jmp    119e <filter+0x8e>
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1030 <fputc@plt>
jmp    11a3 <filter+0x93>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <filter+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter>:
push   %r14
push   %rbx
push   %rax
mov    (%rsi),%al
test   %al,%al
je     1164 <filter+0x54>
mov    %rsi,%rbx
mov    %rdi,%r14
add    $0x1,%rbx
jmp    1148 <filter+0x38>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%al
movzbl %al,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1164 <filter+0x54>
movsbl %al,%eax
cmp    $0x20,%eax
je     1160 <filter+0x50>
cmp    $0xa,%eax
je     1130 <filter+0x20>
cmp    $0x9,%eax
jne    113d <filter+0x2d>
mov    $0x54,%al
jmp    1132 <filter+0x22>
xchg   %ax,%ax
mov    $0x53,%al
jmp    1132 <filter+0x22>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @filter(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %24, %2
%6 = load i8*, i8** %4
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %27
10: ; preds = %5
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
switch i32 %13, label %23 [
i32 32, label %14
i32 9, label %17
i32 10, label %20
]
14: ; preds = %10
%15 = load i32*, i32** %3
%16 = call i32 @fputc(i8 signext 83, i32* %15)
br label %23
17: ; preds = %10
%18 = load i32*, i32** %3
%19 = call i32 @fputc(i8 signext 84, i32* %18)
br label %23
20: ; preds = %10
%21 = load i32*, i32** %3
%22 = call i32 @fputc(i8 signext 10, i32* %21)
br label %23
23: ; preds = %10, %20, %17, %14
br label %24
24: ; preds = %23
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %4
br label %5
27: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @filter(i32* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %2, %14
%6 = phi i8 [ %16, %14 ], [ %3, %2 ]
%7 = phi i8* [ %15, %14 ], [ %1, %2 ]
%8 = sext i8 %6 to i32
switch i32 %8, label %14 [
i32 32, label %11
i32 9, label %9
i32 10, label %10
]
9: ; preds = %5
br label %11
10: ; preds = %5
br label %11
11: ; preds = %5, %10, %9
%12 = phi i8 [ 84, %9 ], [ 10, %10 ], [ 83, %5 ]
%13 = tail call i32 @fputc(i8 signext %12, i32* %0)
br label %14
14: ; preds = %11, %5
%15 = getelementptr inbounds i8, i8* %7, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %5
18: ; preds = %14, %2
ret void
}