#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 */
char *Cmd_SkipSpace(char *);
int /*<<< orphan*/ EEprom_Write_2(int, int);
int /*<<< orphan*/ U3_TxPuts(char *);
int atoi(char *);
int /*<<< orphan*/ csprintf(char *, char *);
int System_Temp(char *buf) {
  char cmd[50];
  int temp;
  if (buf != NULL) {
    buf = Cmd_SkipSpace(buf);
    temp = atoi(buf);
    EEprom_Write_2(1, temp);
    csprintf(cmd, "temp: 0\r\n");
    U3_TxPuts(cmd);
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<System_Temp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11b2 <System_Temp+0x62>
mov    -0x10(%rbp),%rdi
call   1070 <Cmd_SkipSpace@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%esi
mov    $0x1,%edi
call   1050 <EEprom_Write_2@plt>
lea    -0x50(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1030 <csprintf@plt>
lea    -0x50(%rbp),%rdi
call   1040 <U3_TxPuts@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b9 <System_Temp+0x69>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<System_Temp>:
test   %rdi,%rdi
je     1195 <System_Temp+0x45>
push   %rbx
sub    $0x40,%rsp
call   1070 <Cmd_SkipSpace@plt>
mov    %rax,%rdi
call   1060 <atoi@plt>
mov    $0x1,%edi
mov    %eax,%esi
call   1050 <EEprom_Write_2@plt>
lea    0xe86(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <csprintf@plt>
mov    %rbx,%rdi
call   1040 <U3_TxPuts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"temp: 0\0D\0A\00"
define i32 @System_Temp(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [50 x i8]
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %19
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i8* @Cmd_SkipSpace(i8* %9)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = call i32 @atoi(i8* %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = call i32 @EEprom_Write_2(i32 1, i32 %13)
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%16 = call i32 @csprintf(i8* %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%18 = call i32 @U3_TxPuts(i8* %17)
store i32 0, i32* %2
br label %20
19: ; preds = %1
store i32 -1, i32* %2
br label %20
20: ; preds = %19, %8
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@.str = [10 x i8] c"temp: 0\0D\0A\00"
define i32 @System_Temp(i8* %0) {
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%4 = icmp eq i8* %0, null
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = tail call i8* @Cmd_SkipSpace(i8* %0)
%7 = tail call i32 @atoi(i8* %6)
%8 = tail call i32 @EEprom_Write_2(i32 1, i32 %7)
%9 = call i32 @csprintf(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @U3_TxPuts(i8* %3)
br label %11
11: ; preds = %1, %5
%12 = phi i32 [ 0, %5 ], [ -1, %1 ]
ret i32 %12
}