#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*/ noctrl(char *);
int normalize(char *line) {
  int c, i;
  noctrl(line);
  for (i = 0; (c = line[i]) != 0; i++) {
    if (c < ' ' || c > 127)
      line[i] = ' ';
  }
  return (0);
}


x86 assembly (clang, -O0):
<normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <noctrl@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     1177 <normalize+0x67>
cmpl   $0x20,-0xc(%rbp)
jl     1158 <normalize+0x48>
cmpl   $0x7f,-0xc(%rbp)
jle    1164 <normalize+0x54>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
jmp    1169 <normalize+0x59>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112c <normalize+0x1c>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalize>:
push   %rbx
mov    %rdi,%rbx
call   1030 <noctrl@plt>
mov    (%rbx),%al
test   %al,%al
je     1145 <normalize+0x35>
add    $0x1,%rbx
jmp    113b <normalize+0x2b>
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1145 <normalize+0x35>
cmp    $0x1f,%al
jg     1130 <normalize+0x20>
movb   $0x20,-0x1(%rbx)
jmp    1130 <normalize+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @normalize(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @noctrl(i8* %5)
store i32 0, i32* %4
br label %7
7: ; preds = %27, %1
%8 = load i8*, i8** %2
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
store i32 %13, i32* %3
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %30
15: ; preds = %7
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 32
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp sgt i32 %19, 127
br i1 %20, label %21, label %26
21: ; preds = %18, %15
%22 = load i8*, i8** %2
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
store i8 32, i8* %25
br label %26
26: ; preds = %21, %18
br label %27
27: ; preds = %26
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %7
30: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
define i32 @normalize(i8* %0) {
%2 = tail call i32 @noctrl(i8* %0)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %1, %11
%6 = phi i64 [ %12, %11 ], [ 0, %1 ]
%7 = phi i8 [ %14, %11 ], [ %3, %1 ]
%8 = phi i8* [ %13, %11 ], [ %0, %1 ]
%9 = icmp slt i8 %7, 32
br i1 %9, label %10, label %11
10: ; preds = %5
store i8 32, i8* %8
br label %11
11: ; preds = %10, %5
%12 = add nuw i64 %6, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %11, %1
ret i32 0
}