#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 *);
void _lines_rotate(char **lines, int pos) {
  int i;
  free(lines[0]);
  for (i = 1; i <= pos; i++)
    lines[i - 1] = lines[i];
  lines[pos] = NULL;
}


x86 assembly (clang, -O0):
<_lines_rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1169 <_lines_rotate+0x59>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1132 <_lines_rotate+0x22>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_lines_rotate>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
test   %ebp,%ebp
jle    1146 <_lines_rotate+0x26>
lea    0x8(%rbx),%rsi
mov    %ebp,%edx
shl    $0x3,%rdx
mov    %rbx,%rdi
call   1040 <memmove@plt>
movslq %ebp,%rax
movq   $0x0,(%rbx,%rax,8)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @_lines_rotate(i8** nocapture %0, i32 %1) {
%3 = load i8*, i8** %0
%4 = tail call i32 @free(i8* %3)
%5 = icmp slt i32 %1, 1
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = bitcast i8** %0 to i8*
%8 = getelementptr i8*, i8** %0, i64 1
%9 = bitcast i8** %8 to i8*
%10 = zext i32 %1 to i64
%11 = shl nuw nsw i64 %10, 3
br label %12
12: ; preds = %6, %2
%13 = sext i32 %1 to i64
%14 = getelementptr inbounds i8*, i8** %0, i64 %13
store i8* null, i8** %14
ret void
}