#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*/ memmove(char *, char *, size_t const);
int shift_line(char line[], size_t len, size_t offset) {
  const size_t shift_width = len - offset;
  if (shift_width != 0) {
    memmove(line, line + offset, shift_width + 1);
    return (shift_width == 1 && line[0] == '\n');
  }
  return 1;
}


x86 assembly (clang, -O0):
<shift_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1184 <shift_line+0x74>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
add    $0x1,%rdx
call   1030 <memmove@plt>
xor    %eax,%eax
cmpq   $0x1,-0x28(%rbp)
mov    %al,-0x29(%rbp)
jne    1174 <shift_line+0x64>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    118b <shift_line+0x7b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shift_line>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
sub    %rdx,%rbx
je     1144 <shift_line+0x34>
mov    %rdi,%r14
add    %rdi,%rdx
lea    0x1(%rbx),%rax
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <memmove@plt>
xor    %eax,%eax
cmp    $0x1,%rbx
jne    1149 <shift_line+0x39>
xor    %eax,%eax
cmpb   $0xa,(%r14)
sete   %al
jmp    1149 <shift_line+0x39>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @shift_line(i8* %0, i64 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%9 = load i64, i64* %6
%10 = load i64, i64* %7
%11 = sub i64 %9, %10
store i64 %11, i64* %8
%12 = load i64, i64* %8
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %33
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = load i8*, i8** %5
%17 = load i64, i64* %7
%18 = getelementptr inbounds i8, i8* %16, i64 %17
%19 = load i64, i64* %8
%20 = add i64 %19, 1
%21 = call i32 @memmove(i8* %15, i8* %18, i64 %20)
%22 = load i64, i64* %8
%23 = icmp eq i64 %22, 1
br i1 %23, label %24, label %30
24: ; preds = %14
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 10
br label %30
30: ; preds = %24, %14
%31 = phi i1 [ false, %14 ], [ %29, %24 ]
%32 = zext i1 %31 to i32
store i32 %32, i32* %4
br label %34
33: ; preds = %3
store i32 1, i32* %4
br label %34
34: ; preds = %33, %30
%35 = load i32, i32* %4
ret i32 %35
}

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