#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 *, char *);
int set_sysctl_param(char *name, char *value) {
  char msg[128], cmd[512];
  sprintf(msg, "Setting %s to %s", name, value);
  sprintf(cmd, "echo %s > /proc/sys/net/irda/%s", value, name);
  return execute(msg, cmd);
}


x86 assembly (clang, -O0):
<set_sysctl_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x290,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeb7(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x290(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xead(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x90(%rbp),%rdi
lea    -0x290(%rbp),%rsi
call   1030 <execute@plt>
add    $0x290,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_sysctl_param>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x288,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xec5(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1040 <sprintf@plt>
lea    0xebe(%rip),%rsi
lea    0x80(%rsp),%r12
mov    %r12,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1040 <sprintf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <execute@plt>
add    $0x288,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Setting %s to %s\00"
@.str.1 = [32 x i8] c"echo %s > /proc/sys/net/irda/%s\00"
define i32 @set_sysctl_param(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [128 x i8]
%6 = alloca [512 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%12 = load i8*, i8** %4
%13 = load i8*, i8** %3
%14 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* %13)
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%17 = call i32 @execute(i8* %15, i8* %16)
ret i32 %17
}

LLVM IR (-O2):
@.str = [17 x i8] c"Setting %s to %s\00"
@.str.1 = [32 x i8] c"echo %s > /proc/sys/net/irda/%s\00"
define i32 @set_sysctl_param(i8* %0, i8* %1) {
%3 = alloca [128 x i8]
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%8 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %0)
%9 = call i32 @execute(i8* %5, i8* %6)
ret i32 %9
}