#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 */
struct ttrie__obj {
  int dummy;
};

/* Variables and functions */
unsigned int choice_find_add_table(struct ttrie__obj *, char *, unsigned char);
unsigned int choice_row_append(struct ttrie__obj *, unsigned int,
                               unsigned char **);
int /*<<< orphan*/ encode_id(int /*<<< orphan*/, unsigned int, unsigned int,
                             unsigned char *);
int choice_new_row(struct ttrie__obj *tt, char *table_name,
                   unsigned char name_len, unsigned char (*row_id)[5],
                   unsigned char result_id[5]) {
  unsigned int table_number = choice_find_add_table(tt, table_name, name_len);
  unsigned int row_i = choice_row_append(tt, table_number, row_id);
  encode_id(0, table_number, row_i, result_id);
  return 0;
}


x86 assembly (clang, -O0):
<choice_new_row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movzbl -0x11(%rbp),%edx
call   1050 <choice_find_add_table@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <choice_row_append@plt>
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
mov    -0x28(%rbp),%rcx
xor    %edi,%edi
call   1030 <encode_id@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<choice_new_row>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdi,%rbx
call   1050 <choice_find_add_table@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r15,%rdx
call   1040 <choice_row_append@plt>
xor    %edi,%edi
mov    %ebp,%esi
mov    %eax,%edx
mov    %r14,%rcx
call   1030 <encode_id@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ttrie__obj = type { i32 }
define i32 @choice_new_row(%struct.ttrie__obj* %0, i8* %1, i8 zeroext %2, [5 x i8]* %3, i8* %4) {
%6 = alloca %struct.ttrie__obj*
%7 = alloca i8*
%8 = alloca i8
%9 = alloca [5 x i8]*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
store %struct.ttrie__obj* %0, %struct.ttrie__obj** %6
store i8* %1, i8** %7
store i8 %2, i8* %8
store [5 x i8]* %3, [5 x i8]** %9
store i8* %4, i8** %10
%13 = load %struct.ttrie__obj*, %struct.ttrie__obj** %6
%14 = load i8*, i8** %7
%15 = load i8, i8* %8
%16 = call i32 @choice_find_add_table(%struct.ttrie__obj* %13, i8* %14, i8 zeroext %15)
store i32 %16, i32* %11
%17 = load %struct.ttrie__obj*, %struct.ttrie__obj** %6
%18 = load i32, i32* %11
%19 = load [5 x i8]*, [5 x i8]** %9
%20 = bitcast [5 x i8]* %19 to i8**
%21 = call i32 @choice_row_append(%struct.ttrie__obj* %17, i32 %18, i8** %20)
store i32 %21, i32* %12
%22 = load i32, i32* %11
%23 = load i32, i32* %12
%24 = load i8*, i8** %10
%25 = call i32 @encode_id(i32 0, i32 %22, i32 %23, i8* %24)
ret i32 0
}

LLVM IR (-O2):
%struct.ttrie__obj = type { i32 }
define i32 @choice_new_row(%struct.ttrie__obj* %0, i8* %1, i8 zeroext %2, [5 x i8]* %3, i8* %4) {
%6 = tail call i32 @choice_find_add_table(%struct.ttrie__obj* %0, i8* %1, i8 zeroext %2)
%7 = bitcast [5 x i8]* %3 to i8**
%8 = tail call i32 @choice_row_append(%struct.ttrie__obj* %0, i32 %6, i8** %7)
%9 = tail call i32 @encode_id(i32 0, i32 %6, i32 %8, i8* %4)
ret i32 0
}