#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 execv(char *, char **);
int fork();
int /*<<< orphan*/ wait(int *);
int send_notification(char *urgency, char *summary, char *body) {
  int status;
  char *argv[6];
  argv[0] = "/usr/bin/notify-send";
  argv[1] = "-u";
  argv[2] = urgency;
  argv[3] = summary;
  argv[4] = body;
  argv[5] = NULL;
  switch (fork()) {
  case -1:
    return -1;
  case 0:
    return execv("/usr/bin/notify-send", argv);
  default:
    wait(&status);
    return status;
  }
}


x86 assembly (clang, -O0):
<send_notification>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    0xeb5(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xebf(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x38(%rbp)
xor    %eax,%eax
call   1050 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x64(%rbp)
sub    $0xffffffff,%eax
je     11a4 <send_notification+0x74>
jmp    1194 <send_notification+0x64>
mov    -0x64(%rbp),%eax
test   %eax,%eax
je     11b0 <send_notification+0x80>
jmp    11c8 <send_notification+0x98>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d7 <send_notification+0xa7>
lea    -0x60(%rbp),%rsi
lea    0xe45(%rip),%rdi
call   1040 <execv@plt>
mov    %eax,-0x4(%rbp)
jmp    11d7 <send_notification+0xa7>
lea    -0x24(%rbp),%rdi
call   1030 <wait@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_notification>:
sub    $0x48,%rsp
lea    0xec5(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xece(%rip),%rax
mov    %rax,0x18(%rsp)
mov    %rdi,0x20(%rsp)
mov    %rsi,0x28(%rsp)
mov    %rdx,0x30(%rsp)
movq   $0x0,0x38(%rsp)
xor    %eax,%eax
call   1050 <fork@plt>
cmp    $0xffffffff,%eax
je     1198 <send_notification+0x68>
test   %eax,%eax
jne    118a <send_notification+0x5a>
lea    0xe85(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <execv@plt>
add    $0x48,%rsp
ret
lea    0xc(%rsp),%rdi
call   1030 <wait@plt>
mov    0xc(%rsp),%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"/usr/bin/notify-send\00"
@.str.1 = [3 x i8] c"-u\00"
define i32 @send_notification(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [6 x i8*]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%10 = getelementptr inbounds [6 x i8*], [6 x i8*]* %9, i64 0, i64 0
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds [6 x i8*], [6 x i8*]* %9, i64 0, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %11
%12 = load i8*, i8** %5
%13 = getelementptr inbounds [6 x i8*], [6 x i8*]* %9, i64 0, i64 2
store i8* %12, i8** %13
%14 = load i8*, i8** %6
%15 = getelementptr inbounds [6 x i8*], [6 x i8*]* %9, i64 0, i64 3
store i8* %14, i8** %15
%16 = load i8*, i8** %7
%17 = getelementptr inbounds [6 x i8*], [6 x i8*]* %9, i64 0, i64 4
store i8* %16, i8** %17
%18 = getelementptr inbounds [6 x i8*], [6 x i8*]* %9, i64 0, i64 5
store i8* null, i8** %18
%19 = call i32 (...) @fork()
switch i32 %19, label %24 [
i32 -1, label %20
i32 0, label %21
]
20: ; preds = %3
store i32 -1, i32* %4
br label %27
21: ; preds = %3
%22 = getelementptr inbounds [6 x i8*], [6 x i8*]* %9, i64 0, i64 0
%23 = call i32 @execv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8** %22)
store i32 %23, i32* %4
br label %27
24: ; preds = %3
%25 = call i32 @wait(i32* %8)
%26 = load i32, i32* %8
store i32 %26, i32* %4
br label %27
27: ; preds = %24, %21, %20
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
@.str = [21 x i8] c"/usr/bin/notify-send\00"
@.str.1 = [3 x i8] c"-u\00"
define i32 @send_notification(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca [6 x i8*]
%6 = bitcast i32* %4 to i8*
%7 = bitcast [6 x i8*]* %5 to i8*
%8 = getelementptr inbounds [6 x i8*], [6 x i8*]* %5, i64 0, i64 0
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [6 x i8*], [6 x i8*]* %5, i64 0, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [6 x i8*], [6 x i8*]* %5, i64 0, i64 2
store i8* %0, i8** %10
%11 = getelementptr inbounds [6 x i8*], [6 x i8*]* %5, i64 0, i64 3
store i8* %1, i8** %11
%12 = getelementptr inbounds [6 x i8*], [6 x i8*]* %5, i64 0, i64 4
store i8* %2, i8** %12
%13 = getelementptr inbounds [6 x i8*], [6 x i8*]* %5, i64 0, i64 5
store i8* null, i8** %13
%14 = tail call i32 (...) @fork()
switch i32 %14, label %17 [
i32 -1, label %20
i32 0, label %15
]
15: ; preds = %3
%16 = call i32 @execv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8** %8)
br label %20
17: ; preds = %3
%18 = call i32 @wait(i32* %4)
%19 = load i32, i32* %4
br label %20
20: ; preds = %3, %17, %15
%21 = phi i32 [ %19, %17 ], [ %16, %15 ], [ %14, %3 ]
ret i32 %21
}