#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*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strlen(char *);
int f_table(int mode, unsigned char **sec, float *data, unsigned int ndata,
            char *inv_out, void **local) {
  if (mode >= 0) {
    sprintf(inv_out, "discipline=%d", ((int)(sec[0][6])));
    inv_out += strlen(inv_out);
    sprintf(inv_out, " master_table=%d", ((int)(sec[1][9])));
    inv_out += strlen(inv_out);
    sprintf(inv_out, " local_table=%d", ((int)(sec[1][10])));
  }
  return 0;
}


x86 assembly (clang, -O0):
<f_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     11cd <f_table+0xad>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movzbl 0x6(%rax),%edx
lea    0xea2(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movzbl 0x9(%rax),%edx
lea    0xe7b(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movzbl 0xa(%rax),%edx
lea    0xe57(%rip),%rsi
call   1040 <sprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_table>:
test   %edi,%edi
js     1191 <f_table+0x71>
push   %r15
push   %r14
push   %rbx
mov    %r8,%r15
mov    %rsi,%r14
mov    (%rsi),%rax
movzbl 0x6(%rax),%edx
lea    0xec3(%rip),%rsi
mov    %r8,%rdi
call   1040 <sprintf@plt>
mov    %r15,%rdi
call   1030 <strlen@plt>
movslq %eax,%rbx
add    %r15,%rbx
mov    0x8(%r14),%rax
movzbl 0x9(%rax),%edx
lea    0xeac(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
mov    0x8(%r14),%rax
movzbl 0xa(%rax),%edx
lea    0xe98(%rip),%rsi
call   1040 <sprintf@plt>
pop    %rbx
pop    %r14
pop    %r15
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [14 x i8] c"discipline=%d\00"
@.str.1 = [17 x i8] c" master_table=%d\00"
@.str.2 = [16 x i8] c" local_table=%d\00"
define i32 @f_table(i32 %0, i8** %1, float* %2, i32 %3, i8* %4, i8** %5) {
%7 = alloca i32
%8 = alloca i8**
%9 = alloca float*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8**
store i32 %0, i32* %7
store i8** %1, i8*** %8
store float* %2, float** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i8** %5, i8*** %12
%13 = load i32, i32* %7
%14 = icmp sge i32 %13, 0
br i1 %14, label %15, label %50
15: ; preds = %6
%16 = load i8*, i8** %11
%17 = load i8**, i8*** %8
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i64 6
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = load i8*, i8** %11
%25 = call i32 @strlen(i8* %24)
%26 = load i8*, i8** %11
%27 = sext i32 %25 to i64
%28 = getelementptr inbounds i8, i8* %26, i64 %27
store i8* %28, i8** %11
%29 = load i8*, i8** %11
%30 = load i8**, i8*** %8
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i64 9
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = call i32 @sprintf(i8* %29, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = load i8*, i8** %11
%38 = call i32 @strlen(i8* %37)
%39 = load i8*, i8** %11
%40 = sext i32 %38 to i64
%41 = getelementptr inbounds i8, i8* %39, i64 %40
store i8* %41, i8** %11
%42 = load i8*, i8** %11
%43 = load i8**, i8*** %8
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = getelementptr inbounds i8, i8* %45, i64 10
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = call i32 @sprintf(i8* %42, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %15, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"discipline=%d\00"
@.str.1 = [17 x i8] c" master_table=%d\00"
@.str.2 = [16 x i8] c" local_table=%d\00"
define i32 @f_table(i32 %0, i8** nocapture %1, float* nocapture readnone %2, i32 %3, i8* %4, i8** nocapture readnone %5) {
%7 = icmp sgt i32 %0, -1
br i1 %7, label %8, label %31
8: ; preds = %6
%9 = load i8*, i8** %1
%10 = getelementptr inbounds i8, i8* %9, i64 6
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = tail call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = tail call i32 @strlen(i8* %4)
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %4, i64 %15
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8, i8* %18, i64 9
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = tail call i32 @sprintf(i8* dereferenceable(1) %16, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = tail call i32 @strlen(i8* %16)
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %16, i64 %24
%26 = load i8*, i8** %17
%27 = getelementptr inbounds i8, i8* %26, i64 10
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = tail call i32 @sprintf(i8* dereferenceable(1) %25, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %8, %6
ret i32 0
}