#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 */
typedef int uint32_t;
struct t_safeu_struct {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
scalar_t__ get_number_of_identities(struct t_safeu_struct *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ test_file_encryption(struct t_safeu_struct *, int);
void safeu_files_test(struct t_safeu_struct *ac) {
  uint32_t i;
  if (get_number_of_identities(ac) == 0) {
    fputs("safeu: "
          "no identities: cannot run tests\n",
          stderr);
    abort();
  }
  for (i = 0; i < (((128) / 8) + 2); i++) {
    test_file_encryption(ac, i);
  }
  for (i = 0; i < (((128) / 8) + 2); i++) {
    test_file_encryption(ac, i + ((1 << 16) / 2) - 1);
  }
  for (i = 0; i < ((((128) / 8) + 2) * 2); i++) {
    test_file_encryption(ac, (1 << 16) + i - ((128) / 8));
  }
  for (i = 0; i < 3; i++) {
    test_file_encryption(ac, (1 << 16) * 2 + i - 1);
  }
}


x86 assembly (clang, -O0):
<safeu_files_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <get_number_of_identities@plt>
cmp    $0x0,%rax
jne    117b <safeu_files_test+0x3b>
mov    0x2e7a(%rip),%rax
mov    (%rax),%esi
lea    0xe91(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x0,%al
call   1030 <abort@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x12,-0xc(%rbp)
jge    11a6 <safeu_files_test+0x66>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <test_file_encryption@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1182 <safeu_files_test+0x42>
movl   $0x0,-0xc(%rbp)
cmpl   $0x12,-0xc(%rbp)
jge    11da <safeu_files_test+0x9a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x8000,%esi
sub    $0x1,%esi
call   1060 <test_file_encryption@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ad <safeu_files_test+0x6d>
movl   $0x0,-0xc(%rbp)
cmpl   $0x24,-0xc(%rbp)
jge    120e <safeu_files_test+0xce>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x10000,%esi
sub    $0x10,%esi
call   1060 <test_file_encryption@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e1 <safeu_files_test+0xa1>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1242 <safeu_files_test+0x102>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x20000,%esi
sub    $0x1,%esi
call   1060 <test_file_encryption@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1215 <safeu_files_test+0xd5>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safeu_files_test>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1050 <get_number_of_identities@plt>
test   %rax,%rax
je     1372 <safeu_files_test+0x232>
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0xe,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x7fff,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x8000,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x8001,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x8002,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x8003,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x8004,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x8005,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x8006,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x8007,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x8008,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x8009,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x800a,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x800b,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x800c,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x800d,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x800e,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x800f,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x8010,%esi
call   1060 <test_file_encryption@plt>
mov    $0xfff0,%ebp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <test_file_encryption@plt>
add    $0x1,%ebp
cmp    $0x10014,%ebp
jne    1330 <safeu_files_test+0x1f0>
mov    %rbx,%rdi
mov    $0x1ffff,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x20000,%esi
call   1060 <test_file_encryption@plt>
mov    %rbx,%rdi
mov    $0x20001,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <test_file_encryption@plt>
mov    0x2c67(%rip),%rax
mov    (%rax),%esi
lea    0xc7e(%rip),%rdi
call   1040 <fputs@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.t_safeu_struct = type { i32 }
@.str = [40 x i8] c"safeu: no identities: cannot run tests\0A\00"
@stderr = global i32 0
define void @safeu_files_test(%struct.t_safeu_struct* %0) {
%2 = alloca %struct.t_safeu_struct*
%3 = alloca i32
store %struct.t_safeu_struct* %0, %struct.t_safeu_struct** %2
%4 = load %struct.t_safeu_struct*, %struct.t_safeu_struct** %2
%5 = call i64 @get_number_of_identities(%struct.t_safeu_struct* %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fputs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %1
store i32 0, i32* %3
br label %12
12: ; preds = %19, %11
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 18
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load %struct.t_safeu_struct*, %struct.t_safeu_struct** %2
%17 = load i32, i32* %3
%18 = call i32 @test_file_encryption(%struct.t_safeu_struct* %16, i32 %17)
br label %19
19: ; preds = %15
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %12
22: ; preds = %12
store i32 0, i32* %3
br label %23
23: ; preds = %32, %22
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 18
br i1 %25, label %26, label %35
26: ; preds = %23
%27 = load %struct.t_safeu_struct*, %struct.t_safeu_struct** %2
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 32768
%30 = sub nsw i32 %29, 1
%31 = call i32 @test_file_encryption(%struct.t_safeu_struct* %27, i32 %30)
br label %32
32: ; preds = %26
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %23
35: ; preds = %23
store i32 0, i32* %3
br label %36
36: ; preds = %45, %35
%37 = load i32, i32* %3
%38 = icmp slt i32 %37, 36
br i1 %38, label %39, label %48
39: ; preds = %36
%40 = load %struct.t_safeu_struct*, %struct.t_safeu_struct** %2
%41 = load i32, i32* %3
%42 = add nsw i32 65536, %41
%43 = sub nsw i32 %42, 16
%44 = call i32 @test_file_encryption(%struct.t_safeu_struct* %40, i32 %43)
br label %45
45: ; preds = %39
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 1
store i32 %47, i32* %3
br label %36
48: ; preds = %36
store i32 0, i32* %3
br label %49
49: ; preds = %58, %48
%50 = load i32, i32* %3
%51 = icmp slt i32 %50, 3
br i1 %51, label %52, label %61
52: ; preds = %49
%53 = load %struct.t_safeu_struct*, %struct.t_safeu_struct** %2
%54 = load i32, i32* %3
%55 = add nsw i32 131072, %54
%56 = sub nsw i32 %55, 1
%57 = call i32 @test_file_encryption(%struct.t_safeu_struct* %53, i32 %56)
br label %58
58: ; preds = %52
%59 = load i32, i32* %3
%60 = add nsw i32 %59, 1
store i32 %60, i32* %3
br label %49
61: ; preds = %49
ret void
}

LLVM IR (-O2):
%struct.t_safeu_struct = type { i32 }
@.str = [40 x i8] c"safeu: no identities: cannot run tests\0A\00"
@stderr = global i32 0
define void @safeu_files_test(%struct.t_safeu_struct* %0) {
%2 = tail call i64 @get_number_of_identities(%struct.t_safeu_struct* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %41, label %4
4: ; preds = %1
%5 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 0)
%6 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 1)
%7 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 2)
%8 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 3)
%9 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 4)
%10 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 5)
%11 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 6)
%12 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 7)
%13 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 8)
%14 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 9)
%15 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 10)
%16 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 11)
%17 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 12)
%18 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 13)
%19 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 14)
%20 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 15)
%21 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 16)
%22 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 17)
%23 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32767)
%24 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32768)
%25 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32769)
%26 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32770)
%27 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32771)
%28 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32772)
%29 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32773)
%30 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32774)
%31 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32775)
%32 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32776)
%33 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32777)
%34 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32778)
%35 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32779)
%36 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32780)
%37 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32781)
%38 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32782)
%39 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32783)
%40 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 32784)
br label %45
41: ; preds = %1
%42 = load i32, i32* @stderr
%43 = tail call i32 @fputs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %42)
%44 = tail call i32 (...) @abort()
unreachable
45: ; preds = %4, %45
%46 = phi i32 [ %49, %45 ], [ 0, %4 ]
%47 = add nuw nsw i32 %46, 65520
%48 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 %47)
%49 = add nuw nsw i32 %46, 1
%50 = icmp eq i32 %49, 36
br i1 %50, label %51, label %45
51: ; preds = %45
%52 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 131071)
%53 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 131072)
%54 = tail call i32 @test_file_encryption(%struct.t_safeu_struct* %0, i32 131073)
ret void
}