#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 */
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int system(char *);
int snd_startedProcess_msg(int pid) {
  int val;
  char *command;
  char *str_pid;
  command = malloc(1024 * sizeof(char));
  str_pid = malloc(1024 * sizeof(char));
  strcpy(command, "dbus-send --type=method_call --dest=org.efg.Secapp "
                  "/org/efg/secapp org.efg.Secapp.startedProcess int32:");
  sprintf(str_pid, "%d", pid);
  strcat(command, str_pid);
  val = system(command);
  return val;
}


x86 assembly (clang, -O0):
<snd_startedProcess_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x400,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x400,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xed3(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x10(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snd_startedProcess_msg>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
mov    $0x400,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    $0x400,%edi
call   1050 <malloc@plt>
mov    %rax,%rbp
lea    0xe88(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xee1(%rip),%rsi
mov    %rbp,%rdi
mov    %r14d,%edx
call   1070 <sprintf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <system@plt>

LLVM IR (-O0):
@.str = [104 x i8] c"dbus-send --type=method_call --dest=org.efg.Secapp /org/efg/secapp org.efg.Secapp.startedProcess int32:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @snd_startedProcess_msg(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 %0, i32* %2
%6 = call i8* @malloc(i32 1024)
store i8* %6, i8** %4
%7 = call i8* @malloc(i32 1024)
store i8* %7, i8** %5
%8 = load i8*, i8** %4
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0))
%10 = load i8*, i8** %5
%11 = load i32, i32* %2
%12 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = call i32 @strcat(i8* %13, i8* %14)
%16 = load i8*, i8** %4
%17 = call i32 @system(i8* %16)
store i32 %17, i32* %3
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str = [104 x i8] c"dbus-send --type=method_call --dest=org.efg.Secapp /org/efg/secapp org.efg.Secapp.startedProcess int32:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @snd_startedProcess_msg(i32 %0) {
%2 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%3 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%4 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%6 = tail call i32 @strcat(i8* %2, i8* %3)
%7 = tail call i32 @system(i8* %2)
ret i32 %7
}