#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*/ App_Set_Kp(float);
int /*<<< orphan*/ File_Fifo_Report_Error(char *);
int /*<<< orphan*/ File_Fifo_Respond(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ sscanf(char *, char *, float *);
int /*<<< orphan*/ strcpy(char *, char *);
void File_Fifo_Set_P_Gain(char *tokens) {
  float new_gain = 0.0;
  char buffer[50];
  int response;
  if (tokens != NULL) {
    sscanf(tokens, "%f", &new_gain);
    App_Set_Kp(new_gain);
    response = 0;
  } else {
    strcpy(buffer, "Error:  Tokens - Set P Gain\n");
    File_Fifo_Report_Error(buffer);
    response = -1;
  }
  sprintf(buffer, "%d\n", response);
  File_Fifo_Respond(buffer);
}


x86 assembly (clang, -O0):
<File_Fifo_Set_P_Gain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11a9 <File_Fifo_Set_P_Gain+0x49>
mov    -0x8(%rbp),%rdi
lea    0xe76(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1060 <sscanf@plt>
movss  -0xc(%rbp),%xmm0
call   1040 <App_Set_Kp@plt>
movl   $0x0,-0x44(%rbp)
jmp    11c9 <File_Fifo_Set_P_Gain+0x69>
lea    -0x40(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rdi
call   1070 <File_Fifo_Report_Error@plt>
movl   $0xffffffff,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%edx
lea    0xe49(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x40(%rbp),%rdi
call   1050 <File_Fifo_Respond@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<File_Fifo_Set_P_Gain>:
push   %rbx
sub    $0x50,%rsp
movl   $0x0,0xc(%rsp)
test   %rdi,%rdi
je     1192 <File_Fifo_Set_P_Gain+0x32>
lea    0xe87(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1060 <sscanf@plt>
movss  0xc(%rsp),%xmm0
call   1040 <App_Set_Kp@plt>
xor    %edx,%edx
jmp    11b3 <File_Fifo_Set_P_Gain+0x53>
lea    0xe6a(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1070 <File_Fifo_Report_Error@plt>
mov    $0xffffffff,%edx
lea    0xe66(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <File_Fifo_Respond@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [29 x i8] c"Error: Tokens - Set P Gain\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define void @File_Fifo_Set_P_Gain(i8* %0) {
%2 = alloca i8*
%3 = alloca float
%4 = alloca [50 x i8]
%5 = alloca i32
store i8* %0, i8** %2
store float 0.000000e+00, float* %3
%6 = load i8*, i8** %2
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
%11 = load float, float* %3
%12 = call i32 @App_Set_Kp(float %11)
store i32 0, i32* %5
br label %18
13: ; preds = %1
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%17 = call i32 @File_Fifo_Report_Error(i8* %16)
store i32 -1, i32* %5
br label %18
18: ; preds = %13, %8
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%20 = load i32, i32* %5
%21 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%23 = call i32 @File_Fifo_Respond(i8* %22)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [29 x i8] c"Error: Tokens - Set P Gain\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define void @File_Fifo_Set_P_Gain(i8* %0) {
%2 = alloca float
%3 = alloca [50 x i8]
%4 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%6 = icmp eq i8* %0, null
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
%9 = load float, float* %2
%10 = call i32 @App_Set_Kp(float %9)
br label %14
11: ; preds = %1
%12 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @File_Fifo_Report_Error(i8* %5)
br label %14
14: ; preds = %11, %7
%15 = phi i32 [ 0, %7 ], [ -1, %11 ]
%16 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = call i32 @File_Fifo_Respond(i8* %5)
ret void
}