#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 */

/* Variables and functions */
char *l_getMomenta(int, int, long, int, int *);
char *new_str(char *);
scalar_t__ tt_chktop(int *, long *);
char *tt_getMomenta(int isOrig, int table, long top, int n, int *err) {
  if (tt_chktop(&table, &top)) {
    *err = -5;
    return new_str("");
  }
  return l_getMomenta(isOrig, table, top, n, err);
}


x86 assembly (clang, -O0):
<tt_getMomenta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <tt_chktop@plt>
cmp    $0x0,%rax
je     117f <tt_getMomenta+0x4f>
mov    -0x28(%rbp),%rax
movl   $0xfffffffb,(%rax)
lea    0xe8f(%rip),%rdi
call   1050 <new_str@plt>
mov    %rax,-0x8(%rbp)
jmp    1199 <tt_getMomenta+0x69>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%r8
call   1040 <l_getMomenta@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tt_getMomenta>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %r8,%rbx
mov    %ecx,%r14d
mov    %edi,%ebp
mov    %esi,0x4(%rsp)
mov    %rdx,0x8(%rsp)
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <tt_chktop@plt>
test   %rax,%rax
je     1171 <tt_getMomenta+0x41>
movl   $0xfffffffb,(%rbx)
lea    0xe96(%rip),%rdi
call   1050 <new_str@plt>
jmp    1187 <tt_getMomenta+0x57>
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%rdx
mov    %ebp,%edi
mov    %r14d,%ecx
mov    %rbx,%r8
call   1040 <l_getMomenta@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @tt_getMomenta(i32 %0, i32 %1, i64 %2, i32 %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32*
store i32 %0, i32* %7
store i32 %1, i32* %8
store i64 %2, i64* %9
store i32 %3, i32* %10
store i32* %4, i32** %11
%12 = call i64 @tt_chktop(i32* %8, i64* %9)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %5
%15 = load i32*, i32** %11
store i32 -5, i32* %15
%16 = call i8* @new_str(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i8* %16, i8** %6
br label %24
17: ; preds = %5
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = load i64, i64* %9
%21 = load i32, i32* %10
%22 = load i32*, i32** %11
%23 = call i8* @l_getMomenta(i32 %18, i32 %19, i64 %20, i32 %21, i32* %22)
store i8* %23, i8** %6
br label %24
24: ; preds = %17, %14
%25 = load i8*, i8** %6
ret i8* %25
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @tt_getMomenta(i32 %0, i32 %1, i64 %2, i32 %3, i32* %4) {
%6 = alloca i32
%7 = alloca i64
store i32 %1, i32* %6
store i64 %2, i64* %7
%8 = call i64 @tt_chktop(i32* %6, i64* %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %5
store i32 -5, i32* %4
%11 = call i8* @new_str(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %16
12: ; preds = %5
%13 = load i32, i32* %6
%14 = load i64, i64* %7
%15 = call i8* @l_getMomenta(i32 %0, i32 %13, i64 %14, i32 %3, i32* %4)
br label %16
16: ; preds = %12, %10
%17 = phi i8* [ %11, %10 ], [ %15, %12 ]
ret i8* %17
}