#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 */
int /*<<< orphan*/ free(char *);
long get_num(char *, char *);
int /*<<< orphan*/ s_let(char *, char *);
char *tt_getMomenta(int /*<<< orphan*/, int, long, int, int *);
char *macttMomenta(char *arg) {
  int tbl;
  long top;
  int n;
  int err = 0;
  char *tmp;
  top = get_num("ttMomenta", arg);
  tbl = (int)get_num("ttNomenta", arg);
  n = (int)get_num("ttMomenta", arg);
  tmp = tt_getMomenta(0, tbl, top, n, &err);
  switch (err) {
  case 0:
    s_let(tmp, arg);
    break;
  default:
    *arg = 0;
    break;
  }
  free(tmp);
  return (arg);
}


x86 assembly (clang, -O0):
<macttMomenta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xea2(%rip),%rdi
mov    %rdi,-0x30(%rbp)
call   1040 <get_num@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1040 <get_num@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
call   1040 <get_num@plt>
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
xor    %edi,%edi
lea    -0x20(%rbp),%r8
call   1060 <tt_getMomenta@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%eax
test   %eax,%eax
jne    11c9 <macttMomenta+0x89>
jmp    11b7 <macttMomenta+0x77>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <s_let@plt>
jmp    11d0 <macttMomenta+0x90>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<macttMomenta>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
movl   $0x0,0x4(%rsp)
lea    0xea6(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <get_num@plt>
mov    %rax,%r15
lea    0xe9b(%rip),%rdi
mov    %rbx,%rsi
call   1040 <get_num@plt>
mov    %rax,%r12
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <get_num@plt>
lea    0x4(%rsp),%r8
xor    %edi,%edi
mov    %r12d,%esi
mov    %r15,%rdx
mov    %eax,%ecx
call   1060 <tt_getMomenta@plt>
mov    %rax,%r14
cmpl   $0x0,0x4(%rsp)
je     11a8 <macttMomenta+0x68>
movb   $0x0,(%rbx)
jmp    11b3 <macttMomenta+0x73>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <s_let@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"ttMomenta\00"
@.str.1 = [10 x i8] c"ttNomenta\00"
define i8* @macttMomenta(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %6
%8 = load i8*, i8** %2
%9 = call i64 @get_num(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %8)
store i64 %9, i64* %4
%10 = load i8*, i8** %2
%11 = call i64 @get_num(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = trunc i64 %11 to i32
store i32 %12, i32* %3
%13 = load i8*, i8** %2
%14 = call i64 @get_num(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = trunc i64 %14 to i32
store i32 %15, i32* %5
%16 = load i32, i32* %3
%17 = load i64, i64* %4
%18 = load i32, i32* %5
%19 = call i8* @tt_getMomenta(i32 0, i32 %16, i64 %17, i32 %18, i32* %6)
store i8* %19, i8** %7
%20 = load i32, i32* %6
switch i32 %20, label %25 [
i32 0, label %21
]
21: ; preds = %1
%22 = load i8*, i8** %7
%23 = load i8*, i8** %2
%24 = call i32 @s_let(i8* %22, i8* %23)
br label %27
25: ; preds = %1
%26 = load i8*, i8** %2
store i8 0, i8* %26
br label %27
27: ; preds = %25, %21
%28 = load i8*, i8** %7
%29 = call i32 @free(i8* %28)
%30 = load i8*, i8** %2
ret i8* %30
}

LLVM IR (-O2):
@.str = [10 x i8] c"ttMomenta\00"
@.str.1 = [10 x i8] c"ttNomenta\00"
define i8* @macttMomenta(i8* returned %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = tail call i64 @get_num(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i64 @get_num(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = trunc i64 %5 to i32
%7 = tail call i64 @get_num(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = trunc i64 %7 to i32
%9 = call i8* @tt_getMomenta(i32 0, i32 %6, i64 %4, i32 %8, i32* %2)
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 @s_let(i8* %9, i8* %0)
br label %15
14: ; preds = %1
store i8 0, i8* %0
br label %15
15: ; preds = %14, %12
%16 = call i32 @free(i8* %9)
ret i8* %0
}