#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 FiFileInfo {
  int dummy;
};
struct FiFileContainer {
  int dummy;
};
struct FiFileConflictArray {
  int dummy;
};

/* Variables and functions */
scalar_t__ check_file_matches(struct FiFileInfo *, struct FiFileInfo *);
struct FiFileInfo *fi_file_container_get_file_at(struct FiFileContainer *,
                                                 size_t);
size_t fi_file_container_size(struct FiFileContainer *);
int fi_algo_extract_duplicate(struct FiFileContainer *files,
                              struct FiFileConflictArray *conflicts) {
  size_t total = 0;
  struct FiFileInfo *file, *check;
  total = fi_file_container_size(files);
  for (size_t i = 0; i < total; i++) {
    file = fi_file_container_get_file_at(files, i);
    for (size_t j = 0; j < total; j++) {
      if (i == j)
        continue;
      check = fi_file_container_get_file_at(files, j);
      if (check_file_matches(file, check)) {
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<fi_algo_extract_duplicate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fi_file_container_size@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11fe <fi_algo_extract_duplicate+0xce>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1050 <fi_file_container_get_file_at@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11e8 <fi_algo_extract_duplicate+0xb8>
mov    -0x30(%rbp),%rax
cmp    -0x38(%rbp),%rax
jne    11a5 <fi_algo_extract_duplicate+0x75>
jmp    11d7 <fi_algo_extract_duplicate+0xa7>
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1050 <fi_file_container_get_file_at@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <check_file_matches@plt>
cmp    $0x0,%rax
je     11d2 <fi_algo_extract_duplicate+0xa2>
jmp    11d2 <fi_algo_extract_duplicate+0xa2>
jmp    11d7 <fi_algo_extract_duplicate+0xa7>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1184 <fi_algo_extract_duplicate+0x54>
jmp    11ed <fi_algo_extract_duplicate+0xbd>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    115d <fi_algo_extract_duplicate+0x2d>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fi_algo_extract_duplicate>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r14
call   1040 <fi_file_container_size@plt>
test   %rax,%rax
je     1196 <fi_algo_extract_duplicate+0x66>
mov    %rax,%r15
xor    %r13d,%r13d
jmp    1159 <fi_algo_extract_duplicate+0x29>
xchg   %ax,%ax
add    $0x1,%r13
cmp    %r15,%r13
je     1196 <fi_algo_extract_duplicate+0x66>
mov    %r14,%rdi
mov    %r13,%rsi
call   1050 <fi_file_container_get_file_at@plt>
mov    %rax,%r12
xor    %ebx,%ebx
jmp    1179 <fi_algo_extract_duplicate+0x49>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r15
je     1150 <fi_algo_extract_duplicate+0x20>
cmp    %rbx,%r13
je     1170 <fi_algo_extract_duplicate+0x40>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <fi_file_container_get_file_at@plt>
mov    %r12,%rdi
mov    %rax,%rsi
call   1030 <check_file_matches@plt>
jmp    1170 <fi_algo_extract_duplicate+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.FiFileContainer = type { i32 }
%struct.FiFileConflictArray = type { i32 }
%struct.FiFileInfo = type { i32 }
define i32 @fi_algo_extract_duplicate(%struct.FiFileContainer* %0, %struct.FiFileConflictArray* %1) {
%3 = alloca %struct.FiFileContainer*
%4 = alloca %struct.FiFileConflictArray*
%5 = alloca i64
%6 = alloca %struct.FiFileInfo*
%7 = alloca %struct.FiFileInfo*
%8 = alloca i64
%9 = alloca i64
store %struct.FiFileContainer* %0, %struct.FiFileContainer** %3
store %struct.FiFileConflictArray* %1, %struct.FiFileConflictArray** %4
store i64 0, i64* %5
%10 = load %struct.FiFileContainer*, %struct.FiFileContainer** %3
%11 = call i64 @fi_file_container_size(%struct.FiFileContainer* %10)
store i64 %11, i64* %5
store i64 0, i64* %8
br label %12
12: ; preds = %43, %2
%13 = load i64, i64* %8
%14 = load i64, i64* %5
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %46
16: ; preds = %12
%17 = load %struct.FiFileContainer*, %struct.FiFileContainer** %3
%18 = load i64, i64* %8
%19 = call %struct.FiFileInfo* @fi_file_container_get_file_at(%struct.FiFileContainer* %17, i64 %18)
store %struct.FiFileInfo* %19, %struct.FiFileInfo** %6
store i64 0, i64* %9
br label %20
20: ; preds = %39, %16
%21 = load i64, i64* %9
%22 = load i64, i64* %5
%23 = icmp ult i64 %21, %22
br i1 %23, label %24, label %42
24: ; preds = %20
%25 = load i64, i64* %8
%26 = load i64, i64* %9
%27 = icmp eq i64 %25, %26
br i1 %27, label %28, label %29
28: ; preds = %24
br label %39
29: ; preds = %24
%30 = load %struct.FiFileContainer*, %struct.FiFileContainer** %3
%31 = load i64, i64* %9
%32 = call %struct.FiFileInfo* @fi_file_container_get_file_at(%struct.FiFileContainer* %30, i64 %31)
store %struct.FiFileInfo* %32, %struct.FiFileInfo** %7
%33 = load %struct.FiFileInfo*, %struct.FiFileInfo** %6
%34 = load %struct.FiFileInfo*, %struct.FiFileInfo** %7
%35 = call i64 @check_file_matches(%struct.FiFileInfo* %33, %struct.FiFileInfo* %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %29
br label %38
38: ; preds = %37, %29
br label %39
39: ; preds = %38, %28
%40 = load i64, i64* %9
%41 = add i64 %40, 1
store i64 %41, i64* %9
br label %20
42: ; preds = %20
br label %43
43: ; preds = %42
%44 = load i64, i64* %8
%45 = add i64 %44, 1
store i64 %45, i64* %8
br label %12
46: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
%struct.FiFileContainer = type { i32 }
%struct.FiFileConflictArray = type { i32 }
%struct.FiFileInfo = type { i32 }
define i32 @fi_algo_extract_duplicate(%struct.FiFileContainer* %0, %struct.FiFileConflictArray* nocapture readnone %1) {
%3 = tail call i64 @fi_file_container_size(%struct.FiFileContainer* %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %9, %2
ret i32 0
6: ; preds = %2, %9
%7 = phi i64 [ %10, %9 ], [ 0, %2 ]
%8 = tail call %struct.FiFileInfo* @fi_file_container_get_file_at(%struct.FiFileContainer* %0, i64 %7)
br label %12
9: ; preds = %18
%10 = add nuw i64 %7, 1
%11 = icmp eq i64 %10, %3
br i1 %11, label %5, label %6
12: ; preds = %6, %18
%13 = phi i64 [ 0, %6 ], [ %19, %18 ]
%14 = icmp eq i64 %7, %13
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = tail call %struct.FiFileInfo* @fi_file_container_get_file_at(%struct.FiFileContainer* %0, i64 %13)
%17 = tail call i64 @check_file_matches(%struct.FiFileInfo* %8, %struct.FiFileInfo* %16)
br label %18
18: ; preds = %12, %15
%19 = add nuw i64 %13, 1
%20 = icmp eq i64 %19, %3
br i1 %20, label %9, label %12
}