#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(int /*<<< orphan*/, int /*<<< orphan*/);
void reverse(int *nums, int numsSize) {
  int *l, *r;
  l = nums, r = nums + numsSize - 1;
  while (l < r)
    swap(l++, r--);
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1178 <reverse+0x68>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
mov    %eax,%edi
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x20(%rbp)
mov    %eax,%esi
call   1030 <swap@plt>
jmp    113e <reverse+0x2e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movslq %esi,%rax
lea    (%rdi,%rax,4),%rbx
add    $0xfffffffffffffffc,%rbx
cmp    %rdi,%rbx
jbe    1161 <reverse+0x51>
mov    %rdi,%r14
lea    (%rdi,%rsi,4),%ebp
add    $0xfffffffc,%ebp
mov    %rdi,%r15
add    $0x4,%r15
nopw   0x0(%rax,%rax,1)
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <swap@plt>
add    $0xfffffffffffffffc,%rbx
add    $0xfffffffc,%ebp
lea    0x4(%r15),%rax
add    $0x4,%r14d
cmp    %rbx,%r15
mov    %rax,%r15
jb     1140 <reverse+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @reverse(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32*, i32** %3
store i32* %7, i32** %5
%8 = load i32*, i32** %3
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = getelementptr inbounds i32, i32* %11, i64 -1
store i32* %12, i32** %6
br label %13
13: ; preds = %17, %2
%14 = load i32*, i32** %5
%15 = load i32*, i32** %6
%16 = icmp ult i32* %14, %15
br i1 %16, label %17, label %25
17: ; preds = %13
%18 = load i32*, i32** %5
%19 = getelementptr inbounds i32, i32* %18, i32 1
store i32* %19, i32** %5
%20 = ptrtoint i32* %18 to i32
%21 = load i32*, i32** %6
%22 = getelementptr inbounds i32, i32* %21, i32 -1
store i32* %22, i32** %6
%23 = ptrtoint i32* %21 to i32
%24 = call i32 @swap(i32 %20, i32 %23)
br label %13
25: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @reverse(i32* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = getelementptr inbounds i32, i32* %4, i64 -1
%6 = icmp ugt i32* %5, %0
br i1 %6, label %7, label %18
7: ; preds = %2, %7
%8 = phi i32* [ %16, %7 ], [ %5, %2 ]
%9 = phi i32* [ %10, %7 ], [ %0, %2 ]
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = ptrtoint i32* %9 to i64
%12 = trunc i64 %11 to i32
%13 = ptrtoint i32* %8 to i64
%14 = trunc i64 %13 to i32
%15 = tail call i32 @swap(i32 %12, i32 %14)
%16 = getelementptr inbounds i32, i32* %8, i64 -1
%17 = icmp ult i32* %10, %16
br i1 %17, label %7, label %18
18: ; preds = %7, %2
ret void
}