#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ output_int(int /*<<< orphan*/ *, int);
void output_reloc_table(FILE *output_file, int reloc_cnt, int reloc[]) {
  int i;
  for (i = 0; i < reloc_cnt; i++) {
    output_int(output_file, reloc[i]);
  }
  if ((reloc_cnt & 1) == 0)
    output_int(output_file, 0);
}


x86 assembly (clang, -O0):
<output_reloc_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1158 <output_reloc_table+0x48>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <output_int@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112a <output_reloc_table+0x1a>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1172 <output_reloc_table+0x62>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <output_int@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_reloc_table>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r15
test   %esi,%esi
jle    1145 <output_reloc_table+0x35>
mov    %rdx,%r12
mov    %r14d,%ebx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%r12,%rbp,4),%esi
mov    %r15,%rdi
call   1030 <output_int@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1130 <output_reloc_table+0x20>
test   $0x1,%r14b
jne    115d <output_reloc_table+0x4d>
mov    %r15,%rdi
xor    %esi,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <output_int@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @output_reloc_table(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
store i32 0, i32* %7
br label %8
8: ; preds = %20, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %5
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %23
12: ; preds = %8
%13 = load i32*, i32** %4
%14 = load i32*, i32** %6
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = call i32 @output_int(i32* %13, i32 %18)
br label %20
20: ; preds = %12
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %8
23: ; preds = %8
%24 = load i32, i32* %5
%25 = and i32 %24, 1
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i32*, i32** %4
%29 = call i32 @output_int(i32* %28, i32 0)
br label %30
30: ; preds = %27, %23
ret void
}

LLVM IR (-O2):
define void @output_reloc_table(i32* %0, i32 %1, i32* nocapture %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %12, %7 ]
%9 = getelementptr inbounds i32, i32* %2, i64 %8
%10 = load i32, i32* %9
%11 = tail call i32 @output_int(i32* %0, i32 %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %3
%15 = and i32 %1, 1
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 @output_int(i32* %0, i32 0)
br label %19
19: ; preds = %17, %14
ret void
}