#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*/ swap(void **, int, int);
void reverse_set(char *lineptr[], int nlines) {
  int i;
  int j = nlines;
  for (i = 0; i < (nlines / 2); i++, j--) {
    if (i < nlines) {
      swap((void **)lineptr, i, j);
    }
  }
}


x86 assembly (clang, -O0):
<reverse_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    1181 <reverse_set+0x71>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1165 <reverse_set+0x55>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <swap@plt>
jmp    116a <reverse_set+0x5a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    112c <reverse_set+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_set>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x2,%esi
jl     115e <reverse_set+0x4e>
mov    %esi,%r15d
mov    %rdi,%r14
mov    %esi,%r12d
shr    $0x1f,%r12d
add    %esi,%r12d
sar    %r12d
xor    %ebp,%ebp
mov    %esi,%ebx
jmp    114b <reverse_set+0x3b>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebp
add    $0xffffffff,%ebx
cmp    %ebp,%r12d
je     115e <reverse_set+0x4e>
cmp    %r15d,%ebp
jge    1140 <reverse_set+0x30>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <swap@plt>
jmp    1140 <reverse_set+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @reverse_set(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
store i32 %7, i32* %6
store i32 0, i32* %5
br label %8
8: ; preds = %23, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = sdiv i32 %10, 2
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %28
13: ; preds = %8
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = load i8**, i8*** %3
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = call i32 @swap(i8** %18, i32 %19, i32 %20)
br label %22
22: ; preds = %17, %13
br label %23
23: ; preds = %22
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
%26 = load i32, i32* %6
%27 = add nsw i32 %26, -1
store i32 %27, i32* %6
br label %8
28: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @reverse_set(i8** %0, i32 %1) {
%3 = sdiv i32 %1, 2
%4 = icmp sgt i32 %1, 1
br i1 %4, label %5, label %15
5: ; preds = %2, %11
%6 = phi i32 [ %13, %11 ], [ %1, %2 ]
%7 = phi i32 [ %12, %11 ], [ 0, %2 ]
%8 = icmp slt i32 %7, %1
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 @swap(i8** %0, i32 %7, i32 %6)
br label %11
11: ; preds = %5, %9
%12 = add nuw nsw i32 %7, 1
%13 = add nsw i32 %6, -1
%14 = icmp eq i32 %12, %3
br i1 %14, label %15, label %5
15: ; preds = %11, %2
ret void
}