#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 */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ int32_minmax(int /*<<< orphan*/, int /*<<< orphan*/ *);
void minmax_vector_simple(int32_t *x, int32_t *y, long long n) {
  while (n > 0) {
    *x = int32_minmax(*x, y);
    ++x;
    ++y;
    --n;
  }
}


x86 assembly (clang, -O0):
<minmax_vector_simple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jle    116f <minmax_vector_simple+0x5f>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1030 <int32_minmax@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1124 <minmax_vector_simple+0x14>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minmax_vector_simple>:
push   %r15
push   %r14
push   %rbx
test   %rdx,%rdx
jle    114e <minmax_vector_simple+0x3e>
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
add    $0x1,%r14
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%edi
mov    %r15,%rsi
call   1030 <int32_minmax@plt>
mov    %eax,(%rbx)
add    $0x4,%rbx
add    $0x4,%r15
add    $0xffffffffffffffff,%r14
cmp    $0x1,%r14
ja     1130 <minmax_vector_simple+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @minmax_vector_simple(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
br label %7
7: ; preds = %10, %3
%8 = load i64, i64* %6
%9 = icmp sgt i64 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = load i32*, i32** %5
%14 = call i32 @int32_minmax(i32 %12, i32* %13)
%15 = load i32*, i32** %4
store i32 %14, i32* %15
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i32 1
store i32* %17, i32** %4
%18 = load i32*, i32** %5
%19 = getelementptr inbounds i32, i32* %18, i32 1
store i32* %19, i32** %5
%20 = load i64, i64* %6
%21 = add nsw i64 %20, -1
store i64 %21, i64* %6
br label %7
22: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @minmax_vector_simple(i32* nocapture %0, i32* %1, i64 %2) {
%4 = icmp sgt i64 %2, 0
br i1 %4, label %5, label %15
5: ; preds = %3, %5
%6 = phi i64 [ %13, %5 ], [ %2, %3 ]
%7 = phi i32* [ %12, %5 ], [ %1, %3 ]
%8 = phi i32* [ %11, %5 ], [ %0, %3 ]
%9 = load i32, i32* %8
%10 = tail call i32 @int32_minmax(i32 %9, i32* %7)
store i32 %10, i32* %8
%11 = getelementptr inbounds i32, i32* %8, i64 1
%12 = getelementptr inbounds i32, i32* %7, i64 1
%13 = add nsw i64 %6, -1
%14 = icmp ugt i64 %6, 1
br i1 %14, label %5, label %15
15: ; preds = %5, %3
ret void
}