#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 handle_temp_common(int, int, char *);
int /*<<< orphan*/ info(int /*<<< orphan*/, char *, int, int);
int send_then_recv(int, char, char *, int);
int handle_temp(int devfd, int nodeid, char *arg) {
  int ret;
  ret = send_then_recv(devfd, 'X', ">N%03dSE49,4", nodeid);
  if (ret != 0) {
    info(0, "node %d returned X%03x for TEMP command\n", nodeid, ret);
    return -ret;
  }
  return handle_temp_common(devfd, nodeid, arg);
}


x86 assembly (clang, -O0):
<handle_temp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%ecx
mov    $0x58,%esi
lea    0xeac(%rip),%rdx
call   1030 <send_then_recv@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1187 <handle_temp+0x57>
mov    -0xc(%rbp),%edx
mov    -0x1c(%rbp),%ecx
xor    %edi,%edi
lea    0xe98(%rip),%rsi
call   1050 <info@plt>
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1199 <handle_temp+0x69>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1040 <handle_temp_common@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_temp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebx
mov    %edi,%r15d
lea    0xeba(%rip),%rdx
mov    $0x58,%esi
mov    %ebx,%ecx
call   1030 <send_then_recv@plt>
test   %eax,%eax
je     1179 <handle_temp+0x49>
mov    %eax,%ebp
lea    0xeae(%rip),%rsi
xor    %edi,%edi
mov    %ebx,%edx
mov    %eax,%ecx
call   1050 <info@plt>
neg    %ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15d,%edi
mov    %ebx,%esi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <handle_temp_common@plt>

LLVM IR (-O0):
@.str = [13 x i8] c">N%03dSE49,4\00"
@.str.1 = [41 x i8] c"node %d returned X%03x for TEMP command\0A\00"
define i32 @handle_temp(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @send_then_recv(i32 %9, i8 signext 88, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %10)
store i32 %11, i32* %8
%12 = load i32, i32* %8
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %3
%15 = load i32, i32* %6
%16 = load i32, i32* %8
%17 = call i32 @info(i32 0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %16)
%18 = load i32, i32* %8
%19 = sub nsw i32 0, %18
store i32 %19, i32* %4
br label %25
20: ; preds = %3
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = load i8*, i8** %7
%24 = call i32 @handle_temp_common(i32 %21, i32 %22, i8* %23)
store i32 %24, i32* %4
br label %25
25: ; preds = %20, %14
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
@.str = [13 x i8] c">N%03dSE49,4\00"
@.str.1 = [41 x i8] c"node %d returned X%03x for TEMP command\0A\00"
define i32 @handle_temp(i32 %0, i32 %1, i8* %2) {
%4 = tail call i32 @send_then_recv(i32 %0, i8 signext 88, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @info(i32 0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %4)
%8 = sub nsw i32 0, %4
br label %11
9: ; preds = %3
%10 = tail call i32 @handle_temp_common(i32 %0, i32 %1, i8* %2)
br label %11
11: ; preds = %9, %6
%12 = phi i32 [ %8, %6 ], [ %10, %9 ]
ret i32 %12
}