#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 ManhattanSum(int *, int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  int x[n];
  int y[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &y[i]);
  }
  printf("%d", ManhattanSum(x, y, n));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d2 <main+0xa2>
mov    -0x38(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe41(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    119d <main+0x6d>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    120e <main+0xde>
mov    -0x30(%rbp),%rsi
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe05(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11d9 <main+0xa9>
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdi
mov    -0x8(%rbp),%edx
call   1030 <ManhattanSum@plt>
mov    %eax,%esi
lea    0xdd9(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeb8(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1050 <scanf@plt>
mov    %rsp,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r14
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    -0x2c(%rbp),%edx
mov    %rsp,%r15
lea    0xf(,%rdx,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
test   %edx,%edx
jle    11ec <main+0xbc>
xor    %r13d,%r13d
lea    0xe6d(%rip),%r12
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%r13
movslq -0x2c(%rbp),%rdx
add    $0x4,%rbx
cmp    %rdx,%r13
jl     11a0 <main+0x70>
test   %edx,%edx
jle    11ec <main+0xbc>
xor    %r13d,%r13d
lea    0xe36(%rip),%r12
mov    %r15,%rbx
nopl   (%rax)
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%r13
movslq -0x2c(%rbp),%rdx
add    $0x4,%rbx
cmp    %rdx,%r13
jl     11d0 <main+0xa0>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <ManhattanSum@plt>
lea    0xe02(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = zext i32 %4 to i64
%6 = call i8* @llvm.stacksave()
%7 = alloca i32, i64 %5
%8 = load i32, i32* %1
%9 = zext i32 %8 to i64
%10 = alloca i32, i64 %9
%11 = icmp sgt i32 %8, 0
br i1 %11, label %14, label %22
12: ; preds = %14
%13 = icmp sgt i32 %19, 0
br i1 %13, label %26, label %22
14: ; preds = %0, %14
%15 = phi i64 [ %18, %14 ], [ 0, %0 ]
%16 = getelementptr inbounds i32, i32* %7, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
%18 = add nuw nsw i64 %15, 1
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %18, %20
br i1 %21, label %14, label %12
22: ; preds = %26, %0, %12
%23 = phi i32 [ %19, %12 ], [ %8, %0 ], [ %31, %26 ]
%24 = call i32 @ManhattanSum(i32* %7, i32* %10, i32 %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %24)
ret i32 0
26: ; preds = %12, %26
%27 = phi i64 [ %30, %26 ], [ 0, %12 ]
%28 = getelementptr inbounds i32, i32* %10, i64 %27
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %28)
%30 = add nuw nsw i64 %27, 1
%31 = load i32, i32* %1
%32 = sext i32 %31 to i64
%33 = icmp slt i64 %30, %32
br i1 %33, label %26, label %22
}