#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*/ strncpy(char *, char *, int);
int normalize_assembly_format(const char *original_line,
                              char *normalized_line) {
  int space_flag = 0;
  while (*original_line != 0) {
    if (*original_line == ',') {
      strncpy(normalized_line, ", ", 2);
      normalized_line += 2;
    } else if (*original_line == ' ') {
      space_flag = 1;
    } else {
      if (space_flag != 0) {
        *(normalized_line++) = '\t';
        space_flag = 0;
      }
      *(normalized_line++) = *original_line;
    }
    original_line++;
  }
  *normalized_line = '\0';
  return 0;
}


x86 assembly (clang, -O0):
<normalize_assembly_format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11d9 <normalize_assembly_format+0xc9>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
jne    116d <normalize_assembly_format+0x5d>
mov    -0x10(%rbp),%rdi
lea    0xeae(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    11c8 <normalize_assembly_format+0xb8>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1189 <normalize_assembly_format+0x79>
movl   $0x1,-0x14(%rbp)
jmp    11c3 <normalize_assembly_format+0xb3>
cmpl   $0x0,-0x14(%rbp)
je     11ac <normalize_assembly_format+0x9c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x9,(%rax)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    11c8 <normalize_assembly_format+0xb8>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1127 <normalize_assembly_format+0x17>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalize_assembly_format>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %ebp,%ebp
lea    0xeda(%rip),%r15
jmp    1148 <normalize_assembly_format+0x38>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
add    $0x2,%r14
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x20,%al
je     1180 <normalize_assembly_format+0x70>
cmp    $0x2c,%al
je     1130 <normalize_assembly_format+0x20>
test   %al,%al
je     118b <normalize_assembly_format+0x7b>
test   %ebp,%ebp
je     1166 <normalize_assembly_format+0x56>
movb   $0x9,(%r14)
add    $0x1,%r14
movzbl (%rbx),%eax
mov    %al,(%r14)
add    $0x1,%r14
xor    %ebp,%ebp
add    $0x1,%rbx
jmp    1148 <normalize_assembly_format+0x38>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1,%ebp
add    $0x1,%rbx
jmp    1148 <normalize_assembly_format+0x38>
movb   $0x0,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c", \00"
define i32 @normalize_assembly_format(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %6
6: ; preds = %39, %2
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %42
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 44
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = call i32 @strncpy(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i64 2
store i8* %20, i8** %4
br label %39
21: ; preds = %11
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 32
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 1, i32* %5
br label %38
27: ; preds = %21
%28 = load i32, i32* %5
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i8*, i8** %4
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %4
store i8 9, i8* %31
store i32 0, i32* %5
br label %33
33: ; preds = %30, %27
%34 = load i8*, i8** %3
%35 = load i8, i8* %34
%36 = load i8*, i8** %4
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %4
store i8 %35, i8* %36
br label %38
38: ; preds = %33, %26
br label %39
39: ; preds = %38, %16
%40 = load i8*, i8** %3
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %3
br label %6
42: ; preds = %6
%43 = load i8*, i8** %4
store i8 0, i8* %43
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c", \00"
define i32 @normalize_assembly_format(i8* nocapture %0, i8* %1) {
br label %3
3: ; preds = %20, %2
%4 = phi i8* [ %0, %2 ], [ %23, %20 ]
%5 = phi i8* [ %1, %2 ], [ %21, %20 ]
%6 = phi i32 [ 0, %2 ], [ %22, %20 ]
%7 = load i8, i8* %4
switch i8 %7, label %11 [
i8 0, label %24
i8 44, label %8
i8 32, label %20
]
8: ; preds = %3
%9 = tail call i32 @strncpy(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%10 = getelementptr inbounds i8, i8* %5, i64 2
br label %20
11: ; preds = %3
%12 = icmp eq i32 %6, 0
br i1 %12, label %16, label %13
13: ; preds = %11
%14 = getelementptr inbounds i8, i8* %5, i64 1
store i8 9, i8* %5
%15 = load i8, i8* %4
br label %16
16: ; preds = %13, %11
%17 = phi i8 [ %15, %13 ], [ %7, %11 ]
%18 = phi i8* [ %14, %13 ], [ %5, %11 ]
%19 = getelementptr inbounds i8, i8* %18, i64 1
store i8 %17, i8* %18
br label %20
20: ; preds = %3, %16, %8
%21 = phi i8* [ %10, %8 ], [ %19, %16 ], [ %5, %3 ]
%22 = phi i32 [ %6, %8 ], [ 0, %16 ], [ 1, %3 ]
%23 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
24: ; preds = %3
store i8 0, i8* %5
ret i32 0
}