#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 */
struct SLL {
  int dummy;
};
typedef int /*<<< orphan*/ A;

/* Variables and functions */
struct SLL *SLL_create(int const, int const *);
int /*<<< orphan*/ SLL_destroy(struct SLL *);
struct SLL *SLL_find(struct SLL *, int);
struct SLL *SLL_find_rec(struct SLL *, int);
int main() {
  int const A[] = {1, 2, 3, 4, 5};
  int const n = sizeof(A) / sizeof(A[0]);
  struct SLL *sll = SLL_create(n, A);
  struct SLL const *it1 = SLL_find(sll, 3);
  struct SLL const *it2 = SLL_find_rec(sll, 3);
  SLL_destroy(sll);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xea5(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x5,-0x24(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0x5,%edi
call   1060 <SLL_create@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   1050 <SLL_find@plt>
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   1030 <SLL_find_rec@plt>
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <SLL_destroy@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0xec5(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x5,%edi
call   1060 <SLL_create@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x3,%esi
call   1050 <SLL_find@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <SLL_find_rec@plt>
mov    %rbx,%rdi
call   1040 <SLL_destroy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.SLL = type { i32 }
@__const.main.A = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = alloca %struct.SLL*
%5 = alloca %struct.SLL*
%6 = alloca %struct.SLL*
store i32 0, i32* %1
%7 = bitcast [5 x i32]* %2 to i8*
store i32 5, i32* %3
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%9 = call %struct.SLL* @SLL_create(i32 5, i32* %8)
store %struct.SLL* %9, %struct.SLL** %4
%10 = load %struct.SLL*, %struct.SLL** %4
%11 = call %struct.SLL* @SLL_find(%struct.SLL* %10, i32 3)
store %struct.SLL* %11, %struct.SLL** %5
%12 = load %struct.SLL*, %struct.SLL** %4
%13 = call %struct.SLL* @SLL_find_rec(%struct.SLL* %12, i32 3)
store %struct.SLL* %13, %struct.SLL** %6
%14 = load %struct.SLL*, %struct.SLL** %4
%15 = call i32 @SLL_destroy(%struct.SLL* %14)
ret i32 0
}

LLVM IR (-O2):
%struct.SLL = type { i32 }
@__const.main.A = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call %struct.SLL* @SLL_create(i32 5, i32* %3)
%5 = call %struct.SLL* @SLL_find(%struct.SLL* %4, i32 3)
%6 = call %struct.SLL* @SLL_find_rec(%struct.SLL* %4, i32 3)
%7 = call i32 @SLL_destroy(%struct.SLL* %4)
ret i32 0
}