#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 find_count(int, int /*<<< orphan*/, int *, int);
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char **argv) {
  int numbers[10];
  for (int i = 0; i < 10; ++i) {
    numbers[i] = i + 1;
  }
  printf("find_count(%d, %d, &numbers[%d], %d)\n", 10, 0, 0, 10);
  printf("%d\n", find_count(10, 0, numbers, 10));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    1163 <main+0x43>
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
movslq -0x44(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    113d <main+0x1d>
lea    0xe96(%rip),%rdi
mov    $0xa,%r8d
xor    %ecx,%ecx
mov    %r8d,%esi
mov    %ecx,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdx
mov    $0xa,%ecx
xor    %esi,%esi
mov    %ecx,%edi
call   1040 <find_count@plt>
mov    %eax,%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0xa00000009,%rax
mov    %rax,0x20(%rsp)
lea    0xecf(%rip),%rdi
mov    $0xa,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0xa,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rdx
mov    $0xa,%edi
xor    %esi,%esi
mov    $0xa,%ecx
call   1040 <find_count@plt>
lea    0xec4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"find_count(%d, %d, &numbers[%d], %d)\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %8
8: ; preds = %17, %2
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %7
%13 = add nsw i32 %12, 1
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %15
store i32 %13, i32* %16
br label %17
17: ; preds = %11
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 1
store i32 %19, i32* %7
br label %8
20: ; preds = %8
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 10, i32 0, i32 0, i32 10)
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%23 = call i32 @find_count(i32 10, i32 0, i32* %22, i32 10)
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str = [38 x i8] c"find_count(%d, %d, &numbers[%d], %d)\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%6 = bitcast [10 x i32]* %3 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %6
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %8
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 8
store i32 9, i32* %9
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 9
store i32 10, i32* %10
%11 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 10, i32 0, i32 0, i32 10)
%12 = call i32 @find_count(i32 10, i32 0, i32* %5, i32 10)
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
ret i32 0
}