#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 */
scalar_t__ cif(int, int, int);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
void main() {
  int *a, i, n, nr = 0, y, x;
  scanf("%d%d%d", &x, &y, &n);
  a = (int *)malloc(n * sizeof(int));
  if (x > y) {
    x += y;
    y = x - y;
    x -= y;
  }
  for (i = 0; i < n; i++)
    scanf("%d", &a[i]);
  for (i = 0; i < n; i++)
    nr += cif(x, y, a[i]);
  free(a);
  printf("%d", nr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x14(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x10(%rbp),%rcx
mov    $0x0,%al
call   1060 <scanf@plt>
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11b5 <main+0x65>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11f3 <main+0xa3>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11bc <main+0x6c>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1237 <main+0xe7>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
call   1070 <cif@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11fa <main+0xaa>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%esi
lea    0xdba(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe9f(%rip),%rdi
xor    %ebp,%ebp
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0xc(%rsp),%rcx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
shl    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    0x10(%rsp),%eax
mov    0x14(%rsp),%ecx
cmp    %ecx,%eax
jle    119c <main+0x4c>
mov    %eax,0x14(%rsp)
mov    %ecx,0x10(%rsp)
cmpl   $0x0,0xc(%rsp)
jle    1205 <main+0xb5>
lea    0xe5a(%rip),%r15
mov    %r14,%rbx
xor    %ebp,%ebp
nop
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%rbp
jl     11b0 <main+0x60>
test   %eax,%eax
jle    1203 <main+0xb3>
xor    %ebx,%ebx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    0x10(%rsp),%edi
mov    0x14(%rsp),%esi
mov    (%r14,%rbx,4),%edx
call   1070 <cif@plt>
add    %eax,%ebp
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     11e0 <main+0x90>
jmp    1205 <main+0xb5>
xor    %ebp,%ebp
mov    %r14,%rdi
call   1030 <free@plt>
lea    0xdf0(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %4
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %6, i32* %5, i32* %3)
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = mul i64 %9, 4
%11 = trunc i64 %10 to i32
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %1
%14 = load i32, i32* %6
%15 = load i32, i32* %5
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %27
17: ; preds = %0
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = add nsw i32 %19, %18
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = load i32, i32* %5
%23 = sub nsw i32 %21, %22
store i32 %23, i32* %5
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = sub nsw i32 %25, %24
store i32 %26, i32* %6
br label %27
27: ; preds = %17, %0
store i32 0, i32* %2
br label %28
28: ; preds = %38, %27
%29 = load i32, i32* %2
%30 = load i32, i32* %3
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %41
32: ; preds = %28
%33 = load i32*, i32** %1
%34 = load i32, i32* %2
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %33, i64 %35
%37 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %36)
br label %38
38: ; preds = %32
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
store i32 %40, i32* %2
br label %28
41: ; preds = %28
store i32 0, i32* %2
br label %42
42: ; preds = %59, %41
%43 = load i32, i32* %2
%44 = load i32, i32* %3
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %62
46: ; preds = %42
%47 = load i32, i32* %6
%48 = load i32, i32* %5
%49 = load i32*, i32** %1
%50 = load i32, i32* %2
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %49, i64 %51
%53 = load i32, i32* %52
%54 = call i64 @cif(i32 %47, i32 %48, i32 %53)
%55 = load i32, i32* %4
%56 = sext i32 %55 to i64
%57 = add nsw i64 %56, %54
%58 = trunc i64 %57 to i32
store i32 %58, i32* %4
br label %59
59: ; preds = %46
%60 = load i32, i32* %2
%61 = add nsw i32 %60, 1
store i32 %61, i32* %2
br label %42
62: ; preds = %42
%63 = load i32*, i32** %1
%64 = call i32 @free(i32* %63)
%65 = load i32, i32* %4
%66 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %65)
ret void
}

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