#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 *, int *);
void reverse(int *nums, int sz) {
  int i;
  for (i = 0; i < sz / 2; i++) {
    swap(&nums[i], &nums[sz - i - 1]);
  }
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jge    117c <reverse+0x6c>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
call   1030 <swap@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <reverse+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%esi
jl     114c <reverse+0x3c>
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%r12d
shr    %r12d
add    $0xffffffff,%ebx
mov    %rdi,%r15
xchg   %ax,%ax
movslq %ebx,%rbx
lea    (%r14,%rbx,4),%rsi
mov    %r15,%rdi
call   1030 <swap@plt>
add    $0xffffffff,%ebx
add    $0x4,%r15
add    $0xffffffffffffffff,%r12
jne    1130 <reverse+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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