#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*/ get_string(char *);
int /*<<< orphan*/ halt(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ l_askNbytes(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ *reduce_signal(int /*<<< orphan*/);
int /*<<< orphan*/ s_cat(char *, char *, char *);
int s_len(int /*<<< orphan*/);
int /*<<< orphan*/ s_let(char *, char *);
char *macsendsig(char *arg) {
  char thesig[4];
  int l;
  if (reduce_signal(get_string(arg)) != NULL)
    s_let(arg, thesig);
  else
    halt("Invalid signal specification.", NULL);
  l = s_len(get_string(arg));
  l_askNbytes(s_cat(arg, arg, thesig), "60", l, 2);
  if ((*arg == '0') && (arg[1] == '0'))
    *arg = '\0';
  return arg;
}


x86 assembly (clang, -O0):
<macsendsig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <get_string@plt>
mov    %eax,%edi
call   1070 <reduce_signal@plt>
cmp    $0x0,%rax
je     11a8 <macsendsig+0x38>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <s_let@plt>
jmp    11b8 <macsendsig+0x48>
lea    0xe51(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1090 <halt@plt>
mov    -0x8(%rbp),%rdi
call   1080 <get_string@plt>
mov    %eax,%edi
call   1040 <s_len@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1060 <s_cat@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%edx
lea    0xe36(%rip),%rsi
mov    $0x2,%ecx
call   1030 <l_askNbytes@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    121a <macsendsig+0xaa>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x30,%eax
jne    121a <macsendsig+0xaa>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<macsendsig>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1080 <get_string@plt>
mov    %eax,%edi
call   1070 <reduce_signal@plt>
test   %rax,%rax
je     1196 <macsendsig+0x26>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <s_let@plt>
jmp    11a4 <macsendsig+0x34>
lea    0xe63(%rip),%rdi
xor    %esi,%esi
call   1090 <halt@plt>
mov    %rbx,%rdi
call   1080 <get_string@plt>
mov    %eax,%edi
call   1040 <s_len@plt>
mov    %eax,%ebp
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1060 <s_cat@plt>
lea    0xe52(%rip),%rsi
mov    %eax,%edi
mov    %ebp,%edx
mov    $0x2,%ecx
call   1030 <l_askNbytes@plt>
cmpb   $0x30,(%rbx)
jne    11e8 <macsendsig+0x78>
cmpb   $0x30,0x1(%rbx)
jne    11e8 <macsendsig+0x78>
movb   $0x0,(%rbx)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Invalid signal specification.\00"
@.str.1 = [3 x i8] c"60\00"
define i8* @macsendsig(i8* %0) {
%2 = alloca i8*
%3 = alloca [4 x i8]
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @get_string(i8* %5)
%7 = call i32* @reduce_signal(i32 %6)
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%12 = call i32 @s_let(i8* %10, i8* %11)
br label %15
13: ; preds = %1
%14 = call i32 @halt(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32* null)
br label %15
15: ; preds = %13, %9
%16 = load i8*, i8** %2
%17 = call i32 @get_string(i8* %16)
%18 = call i32 @s_len(i32 %17)
store i32 %18, i32* %4
%19 = load i8*, i8** %2
%20 = load i8*, i8** %2
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%22 = call i32 @s_cat(i8* %19, i8* %20, i8* %21)
%23 = load i32, i32* %4
%24 = call i32 @l_askNbytes(i32 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 2)
%25 = load i8*, i8** %2
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 48
br i1 %28, label %29, label %37
29: ; preds = %15
%30 = load i8*, i8** %2
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 48
br i1 %34, label %35, label %37
35: ; preds = %29
%36 = load i8*, i8** %2
store i8 0, i8* %36
br label %37
37: ; preds = %35, %29, %15
%38 = load i8*, i8** %2
ret i8* %38
}

LLVM IR (-O2):
@.str = [30 x i8] c"Invalid signal specification.\00"
@.str.1 = [3 x i8] c"60\00"
define i8* @macsendsig(i8* returned %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @get_string(i8* %0)
%5 = tail call i32* @reduce_signal(i32 %4)
%6 = icmp eq i32* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 @s_let(i8* %0, i8* %3)
br label %11
9: ; preds = %1
%10 = tail call i32 @halt(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32* null)
br label %11
11: ; preds = %9, %7
%12 = call i32 @get_string(i8* %0)
%13 = call i32 @s_len(i32 %12)
%14 = call i32 @s_cat(i8* %0, i8* %0, i8* %3)
%15 = call i32 @l_askNbytes(i32 %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 2)
%16 = load i8, i8* %0
%17 = icmp eq i8 %16, 48
br i1 %17, label %18, label %23
18: ; preds = %11
%19 = getelementptr inbounds i8, i8* %0, i64 1
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 48
br i1 %21, label %22, label %23
22: ; preds = %18
store i8 0, i8* %0
br label %23
23: ; preds = %22, %18, %11
ret i8* %0
}