#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*/ print_array(int *, int);
int /*<<< orphan*/ swap_int(int *, int *, int);
int /*<<< orphan*/ swap_int2(int *, int *, int);
void swap_int_test() {
  int arr1[5] = {1, 2, 3, 4, 5};
  int arr2[5] = {6, 7, 8, 9, 10};
  swap_int(arr1, arr2, 5);
  print_array(arr1, 5);
  print_array(arr2, 5);
  swap_int2(arr1, arr2, 5);
  print_array(arr1, 5);
  print_array(arr2, 5);
}


x86 assembly (clang, -O0):
<swap_int_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xebc(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xec2(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xebf(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xebd(%rip),%eax
mov    %eax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x5,%edx
call   1050 <swap_int@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x5,%edx
call   1030 <swap_int2@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_int_test>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    0xed3(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0xedd(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xec2(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1050 <swap_int@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
mov    %r14,%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1030 <swap_int2@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
mov    %r14,%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.swap_int_test.arr1 = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@__const.swap_int_test.arr2 = [5 x i32] [i32 6, i32 7, i32 8, i32 9, i32 10]
define void @swap_int_test() {
%1 = alloca [5 x i32]
%2 = alloca [5 x i32]
%3 = bitcast [5 x i32]* %1 to i8*
%4 = bitcast [5 x i32]* %2 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%7 = call i32 @swap_int(i32* %5, i32* %6, i32 5)
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%9 = call i32 @print_array(i32* %8, i32 5)
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%11 = call i32 @print_array(i32* %10, i32 5)
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%14 = call i32 @swap_int2(i32* %12, i32* %13, i32 5)
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%16 = call i32 @print_array(i32* %15, i32 5)
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%18 = call i32 @print_array(i32* %17, i32 5)
ret void
}

LLVM IR (-O2):
@__const.swap_int_test.arr1 = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@__const.swap_int_test.arr2 = [5 x i32] [i32 6, i32 7, i32 8, i32 9, i32 10]
define void @swap_int_test() {
%1 = alloca [5 x i32]
%2 = alloca [5 x i32]
%3 = bitcast [5 x i32]* %1 to i8*
%4 = bitcast [5 x i32]* %2 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%7 = call i32 @swap_int(i32* %5, i32* %6, i32 5)
%8 = call i32 @print_array(i32* %5, i32 5)
%9 = call i32 @print_array(i32* %6, i32 5)
%10 = call i32 @swap_int2(i32* %5, i32* %6, i32 5)
%11 = call i32 @print_array(i32* %5, i32 5)
%12 = call i32 @print_array(i32* %6, i32 5)
ret void
}