#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*/ line;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int get_token(char *, char **, char **, char **, char **);
int /*<<< orphan*/ unlink(char *);
void manual_cmd_handler(int sig_no) {
  FILE *fp;
  char line[300], *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL;
  int num;
  char tmp_buf[100];
  char cmd_rsp[65536];
  fp = fopen(("/tmp/hcd.cmd"), "r");
  if (fp == NULL) {
    ;
    return;
  }
  fgets(line, sizeof(line), fp);
  fclose(fp);
  unlink(("/tmp/hcd.cmd"));
  num = get_token(line, &t1, &t2, &t3, &t4);
}


x86 assembly (clang, -O0):
<manual_cmd_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x101d0,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x148(%rbp)
movq   $0x0,-0x150(%rbp)
movq   $0x0,-0x158(%rbp)
movq   $0x0,-0x160(%rbp)
lea    0xe6f(%rip),%rdi
lea    0xe75(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11b1 <manual_cmd_handler+0x61>
jmp    1209 <manual_cmd_handler+0xb9>
lea    -0x140(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x12c,%esi
call   1050 <fgets@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xe2a(%rip),%rdi
call   1030 <unlink@plt>
lea    -0x140(%rbp),%rdi
lea    -0x148(%rbp),%rsi
lea    -0x150(%rbp),%rdx
lea    -0x158(%rbp),%rcx
lea    -0x160(%rbp),%r8
call   1070 <get_token@plt>
mov    %eax,-0x164(%rbp)
add    $0x101d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<manual_cmd_handler>:
push   %r14
push   %rbx
sub    $0x158,%rsp
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0xe7c(%rip),%rdi
lea    0xe82(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11db <manual_cmd_handler+0x8b>
mov    %rax,%rbx
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x12c,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xe44(%rip),%rdi
call   1030 <unlink@plt>
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rsp,%r8
mov    %r14,%rdi
call   1070 <get_token@plt>
add    $0x158,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"/tmp/hcd.cmd\00"
@.str.1 = [2 x i8] c"r\00"
define void @manual_cmd_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [300 x i8]
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca [100 x i8]
%11 = alloca [65536 x i8]
store i32 %0, i32* %2
store i8* null, i8** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i8* null, i8** %8
%12 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %3
%13 = load i32*, i32** %3
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %16
15: ; preds = %1
br label %25
16: ; preds = %1
%17 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%18 = load i32*, i32** %3
%19 = call i32 @fgets(i8* %17, i32 300, i32* %18)
%20 = load i32*, i32** %3
%21 = call i32 @fclose(i32* %20)
%22 = call i32 @unlink(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%23 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%24 = call i32 @get_token(i8* %23, i8** %5, i8** %6, i8** %7, i8** %8)
store i32 %24, i32* %9
br label %25
25: ; preds = %16, %15
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"/tmp/hcd.cmd\00"
@.str.1 = [2 x i8] c"r\00"
define void @manual_cmd_handler(i32 %0) {
%2 = alloca [300 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 0
%8 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%9 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%10 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%11 = bitcast i8** %6 to i8*
store i8* null, i8** %6
%12 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %19, label %14
14: ; preds = %1
%15 = call i32 @fgets(i8* %7, i32 300, i32* %12)
%16 = call i32 @fclose(i32* %12)
%17 = call i32 @unlink(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @get_token(i8* %7, i8** %3, i8** %4, i8** %5, i8** %6)
br label %19
19: ; preds = %1, %14
ret void
}