#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 abs(int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *, ...);
void array_op(int a[], int b[], int c[], int n) {
  assert(n > 0);
  for (int i = 0; i < n; i++) {
    c[i] = abs(a[i] - b[i]);
    printf("%d ", c[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<array_op>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11ba <array_op+0x8a>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
sub    (%rax,%rcx,4),%edi
call   1030 <abs@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    115f <array_op+0x2f>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_op>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r13
xor    %edi,%edi
test   %ecx,%ecx
setg   %dil
call   1050 <assert@plt>
test   %ebp,%ebp
jle    1197 <array_op+0x67>
mov    %ebp,%ebp
lea    0xea0(%rip),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13,%rbx,4),%eax
sub    (%r15,%rbx,4),%eax
mov    %eax,%esi
neg    %esi
cmovs  %eax,%esi
mov    %esi,(%r14,%rbx,4)
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <array_op+0x40>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @array_op(i32* %0, i32* %1, i32* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%10 = load i32, i32* %8
%11 = icmp sgt i32 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
store i32 0, i32* %9
br label %14
14: ; preds = %41, %4
%15 = load i32, i32* %9
%16 = load i32, i32* %8
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %44
18: ; preds = %14
%19 = load i32*, i32** %5
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = load i32, i32* %22
%24 = load i32*, i32** %6
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = load i32, i32* %27
%29 = sub nsw i32 %23, %28
%30 = call i32 @abs(i32 %29)
%31 = load i32*, i32** %7
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
store i32 %30, i32* %34
%35 = load i32*, i32** %7
%36 = load i32, i32* %9
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %35, i64 %37
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %18
%42 = load i32, i32* %9
%43 = add nsw i32 %42, 1
store i32 %43, i32* %9
br label %14
44: ; preds = %14
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @array_op(i32* nocapture %0, i32* nocapture %1, i32* nocapture writeonly %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
br i1 %5, label %8, label %10
8: ; preds = %4
%9 = zext i32 %3 to i64
br label %12
10: ; preds = %12, %4
%11 = tail call i32 @putchar(i32 10)
ret void
12: ; preds = %8, %12
%13 = phi i64 [ 0, %8 ], [ %22, %12 ]
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %14
%16 = getelementptr inbounds i32, i32* %1, i64 %13
%17 = load i32, i32* %16
%18 = sub nsw i32 %15, %17
%19 = tail call i32 @llvm.abs.i32(i32 %18, i1 true)
%20 = getelementptr inbounds i32, i32* %2, i64 %13
store i32 %19, i32* %20
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
%22 = add nuw nsw i64 %13, 1
%23 = icmp eq i64 %22, %9
br i1 %23, label %10, label %12
}