#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 fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
void show(char *name, FILE *infile, int count) {
  int c;
  printf("%s", name);
  while (count--) {
    c = fgetc(infile);
    if (c >= 0x20 && c <= 0x7E) {
      printf("%c", c);
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     118f <show+0x6f>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x20,-0x18(%rbp)
jl     118a <show+0x6a>
cmpl   $0x7e,-0x18(%rbp)
jg     118a <show+0x6a>
mov    -0x18(%rbp),%esi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1145 <show+0x25>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%rsi
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
nopw   0x0(%rax,%rax,1)
test   %ebx,%ebx
je     1170 <show+0x40>
add    $0xffffffff,%ebx
mov    %r14,%rdi
call   1050 <fgetc@plt>
lea    -0x20(%rax),%ecx
cmp    $0x5e,%ecx
ja     1150 <show+0x20>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    1150 <show+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @show(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %25, %3
%11 = load i32, i32* %6
%12 = add nsw i32 %11, -1
store i32 %12, i32* %6
%13 = icmp ne i32 %11, 0
br i1 %13, label %14, label %26
14: ; preds = %10
%15 = load i32*, i32** %5
%16 = call i32 @fgetc(i32* %15)
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = icmp sge i32 %17, 32
br i1 %18, label %19, label %25
19: ; preds = %14
%20 = load i32, i32* %7
%21 = icmp sle i32 %20, 126
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* %7
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %19, %14
br label %10
26: ; preds = %10
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @show(i8* %0, i32* nocapture %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = icmp eq i32 %2, 0
br i1 %5, label %16, label %6
6: ; preds = %3, %14
%7 = phi i32 [ %8, %14 ], [ %2, %3 ]
%8 = add nsw i32 %7, -1
%9 = tail call i32 @fgetc(i32* %1)
%10 = add i32 %9, -32
%11 = icmp ult i32 %10, 95
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = tail call i32 @putchar(i32 %9)
br label %14
14: ; preds = %12, %6
%15 = icmp eq i32 %8, 0
br i1 %15, label %16, label %6
16: ; preds = %14, %3
%17 = tail call i32 @putchar(i32 10)
ret void
}