#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*/ manacosts(char *, int *);
int /*<<< orphan*/ nth_element(char *, char, int, char *);
long row_num(int /*<<< orphan*/ *, char, char *, long);
void manasymbols(FILE *fp, long filelength, int *symbol_counts, char card_row,
                 char *buf, char *substring, char delimiter, int del_count) {
  long pos_in_file = 0;
  int i;
  for (;;) {
    if (pos_in_file == filelength)
      break;
    pos_in_file = row_num(fp, card_row, buf, pos_in_file);
    nth_element(buf, delimiter, del_count, substring);
    manacosts(substring, symbol_counts);
  }
}


x86 assembly (clang, -O0):
<manasymbols>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %cl,%al
mov    0x18(%rbp),%ecx
mov    0x10(%rbp),%cl
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1172 <manasymbols+0x42>
jmp    11b5 <manasymbols+0x85>
mov    -0x8(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x28(%rbp),%rdx
mov    -0x38(%rbp),%rcx
movsbl %al,%esi
call   1040 <row_num@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x10(%rbp),%al
mov    0x18(%rbp),%edx
mov    -0x30(%rbp),%rcx
movsbl %al,%esi
call   1050 <nth_element@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <manacosts@plt>
jmp    115f <manasymbols+0x2f>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<manasymbols>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,0x10(%rsp)
test   %rsi,%rsi
je     11a9 <manasymbols+0x79>
mov    %r9,%r14
mov    %r8,%rbx
mov    %rsi,%rbp
mov    %rdi,%r12
xor    %r13d,%r13d
movsbl %cl,%eax
mov    %eax,0xc(%rsp)
movsbl 0x50(%rsp),%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
mov    0xc(%rsp),%esi
mov    %rbx,%rdx
mov    %r13,%rcx
call   1040 <row_num@plt>
mov    %rax,%r13
mov    %rbx,%rdi
mov    %r15d,%esi
mov    0x58(%rsp),%edx
mov    %r14,%rcx
call   1050 <nth_element@plt>
mov    %r14,%rdi
mov    0x10(%rsp),%rsi
call   1030 <manacosts@plt>
cmp    %rbp,%r13
jne    1170 <manasymbols+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @manasymbols(i32* %0, i64 %1, i32* %2, i8 signext %3, i8* %4, i8* %5, i8 signext %6, i32 %7) {
%9 = alloca i32*
%10 = alloca i64
%11 = alloca i32*
%12 = alloca i8
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8
%16 = alloca i32
%17 = alloca i64
%18 = alloca i32
store i32* %0, i32** %9
store i64 %1, i64* %10
store i32* %2, i32** %11
store i8 %3, i8* %12
store i8* %4, i8** %13
store i8* %5, i8** %14
store i8 %6, i8* %15
store i32 %7, i32* %16
store i64 0, i64* %17
br label %19
19: ; preds = %24, %8
%20 = load i64, i64* %17
%21 = load i64, i64* %10
%22 = icmp eq i64 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %19
br label %38
24: ; preds = %19
%25 = load i32*, i32** %9
%26 = load i8, i8* %12
%27 = load i8*, i8** %13
%28 = load i64, i64* %17
%29 = call i64 @row_num(i32* %25, i8 signext %26, i8* %27, i64 %28)
store i64 %29, i64* %17
%30 = load i8*, i8** %13
%31 = load i8, i8* %15
%32 = load i32, i32* %16
%33 = load i8*, i8** %14
%34 = call i32 @nth_element(i8* %30, i8 signext %31, i32 %32, i8* %33)
%35 = load i8*, i8** %14
%36 = load i32*, i32** %11
%37 = call i32 @manacosts(i8* %35, i32* %36)
br label %19
38: ; preds = %23
ret void
}

LLVM IR (-O2):
define void @manasymbols(i32* %0, i64 %1, i32* %2, i8 signext %3, i8* %4, i8* %5, i8 signext %6, i32 %7) {
%9 = icmp eq i64 %1, 0
br i1 %9, label %16, label %10
10: ; preds = %8, %10
%11 = phi i64 [ %12, %10 ], [ 0, %8 ]
%12 = tail call i64 @row_num(i32* %0, i8 signext %3, i8* %4, i64 %11)
%13 = tail call i32 @nth_element(i8* %4, i8 signext %6, i32 %7, i8* %5)
%14 = tail call i32 @manacosts(i8* %5, i32* %2)
%15 = icmp eq i64 %12, %1
br i1 %15, label %16, label %10
16: ; preds = %10, %8
ret void
}