#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*/ alarm(unsigned int);
int atoi(char const *);
int f_alarm(int mode, unsigned char **sec, float *data, unsigned int ndata,
            char *inv_out, void **local, const char *arg1) {
  int i;
  if (mode == -1) {
    i = atoi(arg1);
    alarm(i <= 0 ? 0 : (unsigned int)i);
  } else if (mode == -2) {
    alarm(0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<f_alarm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    117f <f_alarm+0x5f>
mov    0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jg     116c <f_alarm+0x4c>
xor    %eax,%eax
mov    %eax,-0x38(%rbp)
jmp    1172 <f_alarm+0x52>
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%edi
call   1030 <alarm@plt>
jmp    1195 <f_alarm+0x75>
cmpl   $0xfffffffe,-0x4(%rbp)
jne    1190 <f_alarm+0x70>
xor    %edi,%edi
call   1030 <alarm@plt>
jmp    1195 <f_alarm+0x75>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_alarm>:
push   %rax
cmp    $0xfffffffe,%edi
je     113e <f_alarm+0x1e>
cmp    $0xffffffff,%edi
jne    1145 <f_alarm+0x25>
mov    0x10(%rsp),%rdi
call   1040 <atoi@plt>
xor    %edi,%edi
test   %eax,%eax
cmovns %eax,%edi
jmp    1140 <f_alarm+0x20>
xor    %edi,%edi
call   1030 <alarm@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @f_alarm(i32 %0, i8** %1, float* %2, i32 %3, i8* %4, i8** %5, i8* %6) {
%8 = alloca i32
%9 = alloca i8**
%10 = alloca float*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8**
%14 = alloca i8*
%15 = alloca i32
store i32 %0, i32* %8
store i8** %1, i8*** %9
store float* %2, float** %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i8** %5, i8*** %13
store i8* %6, i8** %14
%16 = load i32, i32* %8
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %29
18: ; preds = %7
%19 = load i8*, i8** %14
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %15
%21 = load i32, i32* %15
%22 = icmp sle i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %18
br label %26
24: ; preds = %18
%25 = load i32, i32* %15
br label %26
26: ; preds = %24, %23
%27 = phi i32 [ 0, %23 ], [ %25, %24 ]
%28 = call i32 @alarm(i32 %27)
br label %35
29: ; preds = %7
%30 = load i32, i32* %8
%31 = icmp eq i32 %30, -2
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 @alarm(i32 0)
br label %34
34: ; preds = %32, %29
br label %35
35: ; preds = %34, %26
ret i32 0
}

LLVM IR (-O2):
define i32 @f_alarm(i32 %0, i8** nocapture readnone %1, float* nocapture readnone %2, i32 %3, i8* nocapture readnone %4, i8** nocapture readnone %5, i8* nocapture %6) {
switch i32 %0, label %15 [
i32 -1, label %8
i32 -2, label %12
]
8: ; preds = %7
%9 = tail call i32 @atoi(i8* %6)
%10 = icmp sgt i32 %9, 0
%11 = select i1 %10, i32 %9, i32 0
br label %12
12: ; preds = %7, %8
%13 = phi i32 [ %11, %8 ], [ 0, %7 ]
%14 = tail call i32 @alarm(i32 %13)
br label %15
15: ; preds = %12, %7
ret i32 0
}