#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*/ free(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(char *);
char *proc_input_line(char *line) {
  char *output_line;
  output_line = strdup(line);
  if (!strcmp(output_line, "1\n"))
    strcpy(output_line, "\x0c\n");
  else if (!strcmp(output_line, "\n"))
    ;
  else {
    free(output_line);
    output_line = strdup(line + 1);
  }
  return output_line;
}


x86 assembly (clang, -O0):
<proc_input_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1187 <proc_input_line+0x47>
mov    -0x10(%rbp),%rdi
lea    0xe86(%rip),%rsi
call   1040 <strcpy@plt>
jmp    11c4 <proc_input_line+0x84>
mov    -0x10(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11a5 <proc_input_line+0x65>
jmp    11bf <proc_input_line+0x7f>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1060 <strdup@plt>
mov    %rax,-0x10(%rbp)
jmp    11c4 <proc_input_line+0x84>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proc_input_line>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1060 <strdup@plt>
mov    %rax,%rbx
lea    0xeaa(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1190 <proc_input_line+0x50>
lea    0xe9b(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     119f <proc_input_line+0x5f>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x1,%r14
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <strdup@plt>
lea    0xe6c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"1\0A\00"
@.str.1 = [3 x i8] c"\0C\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define i8* @proc_input_line(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %24
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %12
br label %23
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = call i32 @free(i8* %18)
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = call i8* @strdup(i8* %21)
store i8* %22, i8** %3
br label %23
23: ; preds = %17, %16
br label %24
24: ; preds = %23, %9
%25 = load i8*, i8** %3
ret i8* %25
}

LLVM IR (-O2):
@.str = [3 x i8] c"1\0A\00"
@.str.1 = [3 x i8] c"\0C\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define i8* @proc_input_line(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %14
7: ; preds = %1
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = tail call i32 @free(i8* %2)
%12 = getelementptr inbounds i8, i8* %0, i64 1
%13 = tail call i8* @strdup(i8* %12)
br label %14
14: ; preds = %10, %7, %5
%15 = phi i8* [ %13, %10 ], [ %2, %7 ], [ %2, %5 ]
ret i8* %15
}