#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ si_flags;
  int /*<<< orphan*/ si_boundto;
};
typedef TYPE_1__ Elf64_Syminfo;

/* Variables and functions */
int /*<<< orphan*/ beginblock(int);
int /*<<< orphan*/ endblock();
int /*<<< orphan*/ out(int /*<<< orphan*/);
int /*<<< orphan*/ strdefflags(int /*<<< orphan*/, char *);
int /*<<< orphan*/ strdefint(int /*<<< orphan*/, char *);
void outsyminfo64(void const *ptr, long size, int ndx) {
  Elf64_Syminfo const *syminfos = ptr;
  long count = size / sizeof *syminfos;
  long i;
  (void)ndx;
  beginblock(1);
  for (i = 0; i < count; ++i) {
    beginblock(0);
    (out(strdefint(syminfos[i].si_boundto, "SYMINFO_BT_")));
    (out(strdefflags(syminfos[i].si_flags, "SYMINFO_FLG_")));
    endblock();
  }
  endblock();
}


x86 assembly (clang, -O0):
<outsyminfo64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x3,%rax
mov    %rax,-0x28(%rbp)
mov    $0x1,%edi
call   1060 <beginblock@plt>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    11f3 <outsyminfo64+0xa3>
xor    %edi,%edi
call   1060 <beginblock@plt>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    0x4(%rax,%rcx,8),%edi
lea    0xe4f(%rip),%rsi
call   1030 <strdefint@plt>
mov    %eax,%edi
call   1070 <out@plt>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%edi
lea    0xe3d(%rip),%rsi
call   1040 <strdefflags@plt>
mov    %eax,%edi
call   1070 <out@plt>
mov    $0x0,%al
call   1050 <endblock@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1189 <outsyminfo64+0x39>
mov    $0x0,%al
call   1050 <endblock@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outsyminfo64>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r13
mov    $0x1,%edi
call   1060 <beginblock@plt>
cmp    $0x8,%r14
jb     11cf <outsyminfo64+0x7f>
shr    $0x3,%r14
lea    0xe86(%rip),%r15
lea    0xe8b(%rip),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %edi,%edi
call   1060 <beginblock@plt>
mov    0x4(%r13,%rbx,8),%edi
mov    %r15,%rsi
call   1030 <strdefint@plt>
mov    %eax,%edi
call   1070 <out@plt>
mov    0x0(%r13,%rbx,8),%edi
mov    %r12,%rsi
call   1040 <strdefflags@plt>
mov    %eax,%edi
call   1070 <out@plt>
xor    %eax,%eax
call   1050 <endblock@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1190 <outsyminfo64+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1050 <endblock@plt>

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32, i32 }
@.str = [12 x i8] c"SYMINFO_BT_\00"
@.str.1 = [13 x i8] c"SYMINFO_FLG_\00"
define void @outsyminfo64(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca %struct.TYPE_2__*
%8 = alloca i64
%9 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to %struct.TYPE_2__*
store %struct.TYPE_2__* %11, %struct.TYPE_2__** %7
%12 = load i64, i64* %5
%13 = udiv i64 %12, 8
store i64 %13, i64* %8
%14 = load i32, i32* %6
%15 = call i32 @beginblock(i32 1)
store i64 0, i64* %9
br label %16
16: ; preds = %37, %3
%17 = load i64, i64* %9
%18 = load i64, i64* %8
%19 = icmp slt i64 %17, %18
br i1 %19, label %20, label %40
20: ; preds = %16
%21 = call i32 @beginblock(i32 0)
%22 = load %struct.TYPE_2__*, %struct.TYPE_2__** %7
%23 = load i64, i64* %9
%24 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %22, i64 %23
%25 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %24, i32 0, i32 1
%26 = load i32, i32* %25
%27 = call i32 @strdefint(i32 %26, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%28 = call i32 @out(i32 %27)
%29 = load %struct.TYPE_2__*, %struct.TYPE_2__** %7
%30 = load i64, i64* %9
%31 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %29, i64 %30
%32 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %31, i32 0, i32 0
%33 = load i32, i32* %32
%34 = call i32 @strdefflags(i32 %33, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%35 = call i32 @out(i32 %34)
%36 = call i32 (...) @endblock()
br label %37
37: ; preds = %20
%38 = load i64, i64* %9
%39 = add nsw i64 %38, 1
store i64 %39, i64* %9
br label %16
40: ; preds = %16
%41 = call i32 (...) @endblock()
ret void
}

LLVM IR (-O2):
%struct.TYPE_2__ = type { i32, i32 }
@.str = [12 x i8] c"SYMINFO_BT_\00"
@.str.1 = [13 x i8] c"SYMINFO_FLG_\00"
define void @outsyminfo64(i8* nocapture %0, i64 %1, i32 %2) {
%4 = bitcast i8* %0 to %struct.TYPE_2__*
%5 = tail call i32 @beginblock(i32 1)
%6 = icmp ult i64 %1, 8
br i1 %6, label %23, label %7
7: ; preds = %3
%8 = lshr i64 %1, 3
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ %21, %9 ], [ 0, %7 ]
%11 = tail call i32 @beginblock(i32 0)
%12 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i64 %10, i32 1
%13 = load i32, i32* %12
%14 = tail call i32 @strdefint(i32 %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @out(i32 %14)
%16 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i64 %10, i32 0
%17 = load i32, i32* %16
%18 = tail call i32 @strdefflags(i32 %17, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%19 = tail call i32 @out(i32 %18)
%20 = tail call i32 (...) @endblock()
%21 = add nuw nsw i64 %10, 1
%22 = icmp eq i64 %21, %8
br i1 %22, label %23, label %9
23: ; preds = %9, %3
%24 = tail call i32 (...) @endblock()
ret void
}