#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 /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_safe_index(int, int);
void run_test_list() {
  printf("BEGIN div function tests\n");
  test_safe_index(10, 3);
  printf("\n");
  test_safe_index(2, 5);
  printf("\n");
  test_safe_index(-2, 10);
  printf("\n");
  test_safe_index(10, -2);
  printf("\n");
  test_safe_index(-3, 10);
  printf("\n");
  test_safe_index(10, -3);
  printf("END div function tests\n");
}


x86 assembly (clang, -O0):
<run_test_list>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0x3,%esi
call   1040 <test_safe_index@plt>
lea    0xeea(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
mov    $0x5,%esi
call   1040 <test_safe_index@plt>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    $0xfffffffe,%edi
mov    $0xa,%esi
call   1040 <test_safe_index@plt>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0xfffffffe,%esi
call   1040 <test_safe_index@plt>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    $0xfffffffd,%edi
mov    $0xa,%esi
call   1040 <test_safe_index@plt>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0xfffffffd,%esi
call   1040 <test_safe_index@plt>
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_test_list>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
mov    $0x3,%esi
call   1050 <test_safe_index@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%edi
mov    $0x5,%esi
call   1050 <test_safe_index@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xfffffffe,%edi
mov    $0xa,%esi
call   1050 <test_safe_index@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
mov    $0xfffffffe,%esi
call   1050 <test_safe_index@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xfffffffd,%edi
mov    $0xa,%esi
call   1050 <test_safe_index@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
mov    $0xfffffffd,%esi
call   1050 <test_safe_index@plt>
lea    0xe49(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"BEGIN div function tests\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [24 x i8] c"END div function tests\0A\00"
define void @run_test_list() {
%1 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @test_safe_index(i32 10, i32 3)
%3 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @test_safe_index(i32 2, i32 5)
%5 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @test_safe_index(i32 -2, i32 10)
%7 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @test_safe_index(i32 10, i32 -2)
%9 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @test_safe_index(i32 -3, i32 10)
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @test_safe_index(i32 10, i32 -3)
%13 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [25 x i8] c"BEGIN div function tests\00"
@str.3 = [23 x i8] c"END div function tests\00"
define void @run_test_list() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @test_safe_index(i32 10, i32 3)
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @test_safe_index(i32 2, i32 5)
%5 = tail call i32 @putchar(i32 10)
%6 = tail call i32 @test_safe_index(i32 -2, i32 10)
%7 = tail call i32 @putchar(i32 10)
%8 = tail call i32 @test_safe_index(i32 10, i32 -2)
%9 = tail call i32 @putchar(i32 10)
%10 = tail call i32 @test_safe_index(i32 -3, i32 10)
%11 = tail call i32 @putchar(i32 10)
%12 = tail call i32 @test_safe_index(i32 10, i32 -3)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.3, i64 0, i64 0))
ret void
}