#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 execute(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int execute_on_dev(char *action, char *class, char *dev, int minor) {
  char msg[128], cmd[512];
  sprintf(msg, "%s cmd", action);
  sprintf(cmd, "./%s %s %s %d", class, action, dev, minor);
  return execute(msg, cmd);
}


x86 assembly (clang, -O0):
<execute_on_dev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2a0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x2a0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x2a0(%rbp),%rsi
call   1030 <execute@plt>
add    $0x2a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute_on_dev>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x288,%rsp
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%rbx
lea    0xebc(%rip),%rsi
mov    %rsp,%r12
mov    %r12,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xeac(%rip),%rsi
lea    0x80(%rsp),%r13
mov    %r13,%rdi
mov    %rbp,%rdx
mov    %rbx,%rcx
mov    %r15,%r8
mov    %r14d,%r9d
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <execute@plt>
add    $0x288,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s cmd\00"
@.str.1 = [14 x i8] c"./%s %s %s %d\00"
define i32 @execute_on_dev(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [128 x i8]
%10 = alloca [512 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%12 = load i8*, i8** %5
%13 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%15 = load i8*, i8** %6
%16 = load i8*, i8** %5
%17 = load i8*, i8** %7
%18 = load i32, i32* %8
%19 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %14, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* %16, i8* %17, i32 %18)
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%21 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%22 = call i32 @execute(i8* %20, i8* %21)
ret i32 %22
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s cmd\00"
@.str.1 = [14 x i8] c"./%s %s %s %d\00"
define i32 @execute_on_dev(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca [128 x i8]
%6 = alloca [512 x i8]
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%9 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0)
%10 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %0, i8* %2, i32 %3)
%11 = call i32 @execute(i8* %7, i8* %8)
ret i32 %11
}