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

/* Variables and functions */
int fill_teid_rate_limiter_table(int /*<<< orphan*/, char *, char *, char *);
int sscanf(char const *, char *, int /*<<< orphan*/ *, char *, char *, char *);
int process_teid_rate_limiter(const char *line) {
  uint32_t teid;
  char table_name[100];
  char header_name[100];
  char teid_mode[100];
  int matches = sscanf(line, "%*s %d %s %s %s", &teid, table_name, header_name,
                       teid_mode);
  if (4 != matches)
    return -1;
  return fill_teid_rate_limiter_table(teid, table_name, header_name, teid_mode);
}


x86 assembly (clang, -O0):
<process_teid_rate_limiter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rcx
lea    -0xf0(%rbp),%r8
lea    -0x160(%rbp),%r9
lea    0xeb4(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <sscanf@plt>
mov    %eax,-0x164(%rbp)
mov    $0x4,%eax
cmp    -0x164(%rbp),%eax
je     1178 <process_teid_rate_limiter+0x58>
movl   $0xffffffff,-0x4(%rbp)
jmp    1195 <process_teid_rate_limiter+0x75>
mov    -0x14(%rbp),%edi
lea    -0x80(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
lea    -0x160(%rbp),%rcx
call   1040 <fill_teid_rate_limiter_table@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_teid_rate_limiter>:
sub    $0x158,%rsp
lea    0xed2(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0xf0(%rsp),%rcx
lea    0x80(%rsp),%r8
lea    0x10(%rsp),%r9
call   1030 <sscanf@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x4,%ecx
jne    1177 <process_teid_rate_limiter+0x57>
mov    0xc(%rsp),%edi
lea    0xf0(%rsp),%rsi
lea    0x80(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1040 <fill_teid_rate_limiter_table@plt>
add    $0x158,%rsp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%*s %d %s %s %s\00"
define i32 @process_teid_rate_limiter(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = alloca i32
store i8* %0, i8** %3
%9 = load i8*, i8** %3
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%13 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32* %4, i8* %10, i8* %11, i8* %12)
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = icmp ne i32 4, %14
br i1 %15, label %16, label %17
16: ; preds = %1
store i32 -1, i32* %2
br label %23
17: ; preds = %1
%18 = load i32, i32* %4
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%22 = call i32 @fill_teid_rate_limiter_table(i32 %18, i8* %19, i8* %20, i8* %21)
store i32 %22, i32* %2
br label %23
23: ; preds = %17, %16
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
@.str = [16 x i8] c"%*s %d %s %s %s\00"
define i32 @process_teid_rate_limiter(i8* nocapture %0) {
%2 = alloca i32
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = bitcast i32* %2 to i8*
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%10 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32* %2, i8* %7, i8* %8, i8* %9)
%11 = icmp eq i32 %10, 4
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load i32, i32* %2
%14 = call i32 @fill_teid_rate_limiter_table(i32 %13, i8* %7, i8* %8, i8* %9)
br label %15
15: ; preds = %1, %12
%16 = phi i32 [ %14, %12 ], [ -1, %1 ]
ret i32 %16
}