#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*/ clean_exit();
int /*<<< orphan*/ reset_plugins();
int /*<<< orphan*/ write_log(int, char *, char *);
void handle_usr1() {
  write_log(2,
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/blueness/hwmultd/refs/heads/master/src/"
            "signalhandler.c",
            "SIGUSR1 recieved");
  if (!reset_plugins()) {
    write_log(0,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/blueness/hwmultd/refs/heads/master/"
              "src/signalhandler.c",
              "reset hardware failed");
    clean_exit();
  } else
    write_log(3,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/blueness/hwmultd/refs/heads/master/"
              "src/signalhandler.c",
              "reset hardware");
}


x86 assembly (clang, -O0):
<handle_usr1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
lea    0xec0(%rip),%rsi
lea    0xf4a(%rip),%rdx
call   1040 <write_log@plt>
mov    $0x0,%al
call   1050 <reset_plugins@plt>
cmp    $0x0,%eax
jne    117d <handle_usr1+0x4d>
xor    %edi,%edi
lea    0xe9b(%rip),%rsi
lea    0xf36(%rip),%rdx
call   1040 <write_log@plt>
mov    $0x0,%al
call   1030 <clean_exit@plt>
jmp    1195 <handle_usr1+0x65>
mov    $0x3,%edi
lea    0xe77(%rip),%rsi
lea    0xf28(%rip),%rdx
call   1040 <write_log@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_usr1>:
push   %rax
lea    0xec8(%rip),%rsi
lea    0xf52(%rip),%rdx
mov    $0x2,%edi
call   1040 <write_log@plt>
xor    %eax,%eax
call   1050 <reset_plugins@plt>
lea    0xea9(%rip),%rsi
test   %eax,%eax
je     116d <handle_usr1+0x3d>
lea    0xf56(%rip),%rdx
mov    $0x3,%edi
pop    %rax
jmp    1040 <write_log@plt>
lea    0xf2e(%rip),%rdx
xor    %edi,%edi
call   1040 <write_log@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <clean_exit@plt>

LLVM IR (-O0):
@.str = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/blueness/hwmultd/refs/heads/master/src/signalhandler.c\00"
@.str.1 = [17 x i8] c"SIGUSR1 recieved\00"
@.str.2 = [22 x i8] c"reset hardware failed\00"
@.str.3 = [15 x i8] c"reset hardware\00"
define void @handle_usr1() {
%1 = call i32 @write_log(i32 2, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (...) @reset_plugins()
%3 = icmp ne i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = call i32 @write_log(i32 0, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 (...) @clean_exit()
br label %9
7: ; preds = %0
%8 = call i32 @write_log(i32 3, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %9
9: ; preds = %7, %4
ret void
}

LLVM IR (-O2):
@.str = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/blueness/hwmultd/refs/heads/master/src/signalhandler.c\00"
@.str.1 = [17 x i8] c"SIGUSR1 recieved\00"
@.str.2 = [22 x i8] c"reset hardware failed\00"
@.str.3 = [15 x i8] c"reset hardware\00"
define void @handle_usr1() {
%1 = tail call i32 @write_log(i32 2, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (...) @reset_plugins()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = tail call i32 @write_log(i32 0, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 (...) @clean_exit()
br label %9
7: ; preds = %0
%8 = tail call i32 @write_log(i32 3, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %9
9: ; preds = %7, %4
ret void
}