#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, long);
void set_pwm_speed(long int speed1, long int speed2, long int speed3,
                   long int speed4, FILE *motor1, FILE *motor2, FILE *motor3,
                   FILE *motor4) {
  char speed_c1[] = "PWM_SPEED";
  char speed_c2[] = "PWM_SPEED";
  char speed_c3[] = "PWM_SPEED";
  char speed_c4[] = "PWM_SPEED";
  rewind(motor1);
  rewind(motor2);
  rewind(motor3);
  rewind(motor4);
  speed1 += 1000;
  speed2 += 1000;
  speed3 += 1000;
  speed4 += 1000;
  sprintf(speed_c1, "%ld", speed1);
  sprintf(speed_c2, "%ld", speed2);
  sprintf(speed_c3, "%ld", speed3);
  sprintf(speed_c4, "%ld", speed4);
  fputs(speed_c1, motor1);
  fputs(speed_c2, motor2);
  fputs(speed_c3, motor3);
  fputs(speed_c4, motor4);
}


x86 assembly (clang, -O0):
<set_pwm_speed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x3a(%rbp)
mov    0xe9e(%rip),%ax
mov    %ax,-0x32(%rbp)
mov    0xe8b(%rip),%rax
mov    %rax,-0x44(%rbp)
mov    0xe88(%rip),%ax
mov    %ax,-0x3c(%rbp)
mov    0xe75(%rip),%rax
mov    %rax,-0x4e(%rbp)
mov    0xe72(%rip),%ax
mov    %ax,-0x46(%rbp)
mov    0xe5f(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xe5c(%rip),%ax
mov    %ax,-0x50(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <rewind@plt>
mov    -0x30(%rbp),%rdi
call   1030 <rewind@plt>
mov    0x10(%rbp),%rdi
call   1030 <rewind@plt>
mov    0x18(%rbp),%rdi
call   1030 <rewind@plt>
mov    -0x8(%rbp),%rax
add    $0x3e8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x3e8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x3e8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x3e8,%rax
mov    %rax,-0x20(%rbp)
lea    -0x3a(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xdef(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x44(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xddb(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x4e(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xdc7(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x58(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xdb3(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x3a(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <fputs@plt>
lea    -0x44(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <fputs@plt>
lea    -0x4e(%rbp),%rdi
mov    0x10(%rbp),%rsi
call   1040 <fputs@plt>
lea    -0x58(%rbp),%rdi
mov    0x18(%rbp),%rsi
call   1040 <fputs@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_pwm_speed>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,%rbx
mov    %r9,0x50(%rsp)
mov    %r8,0x48(%rsp)
mov    %rcx,%r12
mov    %rdx,%rbp
mov    %rsi,%r14
mov    %rdi,%r15
mov    0x90(%rsp),%r13
movabs $0x454550535f4d5750,%rax
50 45 45
mov    %rax,0x38(%rsp)
movw   $0x44,0x40(%rsp)
mov    %rax,0x28(%rsp)
movw   $0x44,0x30(%rsp)
mov    %rax,0x18(%rsp)
movw   $0x44,0x20(%rsp)
mov    %rax,0x8(%rsp)
movw   $0x44,0x10(%rsp)
mov    %r8,%rdi
call   1030 <rewind@plt>
mov    %rbx,%rdi
call   1030 <rewind@plt>
mov    %r13,%rdi
call   1030 <rewind@plt>
mov    0x98(%rsp),%rdi
call   1030 <rewind@plt>
add    $0x3e8,%r15
add    $0x3e8,%r14
add    $0x3e8,%rbp
mov    %r12,%rbx
add    $0x3e8,%rbx
lea    0xe26(%rip),%r12
lea    0x38(%rsp),%r13
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
lea    0x28(%rsp),%r15
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1050 <sprintf@plt>
lea    0x18(%rsp),%r14
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
call   1050 <sprintf@plt>
lea    0x8(%rsp),%rbp
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <sprintf@plt>
mov    %r13,%rdi
mov    0x48(%rsp),%rsi
call   1040 <fputs@plt>
mov    %r15,%rdi
mov    0x50(%rsp),%rsi
call   1040 <fputs@plt>
mov    %r14,%rdi
mov    0x90(%rsp),%rsi
call   1040 <fputs@plt>
mov    %rbp,%rdi
mov    0x98(%rsp),%rsi
call   1040 <fputs@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.set_pwm_speed.speed_c1 = [10 x i8] c"PWM_SPEED\00"
@__const.set_pwm_speed.speed_c2 = [10 x i8] c"PWM_SPEED\00"
@__const.set_pwm_speed.speed_c3 = [10 x i8] c"PWM_SPEED\00"
@__const.set_pwm_speed.speed_c4 = [10 x i8] c"PWM_SPEED\00"
@.str = [4 x i8] c"%ld\00"
define void @set_pwm_speed(i64 %0, i64 %1, i64 %2, i64 %3, i32* %4, i32* %5, i32* %6, i32* %7) {
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca [10 x i8]
%18 = alloca [10 x i8]
%19 = alloca [10 x i8]
%20 = alloca [10 x i8]
store i64 %0, i64* %9
store i64 %1, i64* %10
store i64 %2, i64* %11
store i64 %3, i64* %12
store i32* %4, i32** %13
store i32* %5, i32** %14
store i32* %6, i32** %15
store i32* %7, i32** %16
%21 = bitcast [10 x i8]* %17 to i8*
%22 = bitcast [10 x i8]* %18 to i8*
%23 = bitcast [10 x i8]* %19 to i8*
%24 = bitcast [10 x i8]* %20 to i8*
%25 = load i32*, i32** %13
%26 = call i32 @rewind(i32* %25)
%27 = load i32*, i32** %14
%28 = call i32 @rewind(i32* %27)
%29 = load i32*, i32** %15
%30 = call i32 @rewind(i32* %29)
%31 = load i32*, i32** %16
%32 = call i32 @rewind(i32* %31)
%33 = load i64, i64* %9
%34 = add nsw i64 %33, 1000
store i64 %34, i64* %9
%35 = load i64, i64* %10
%36 = add nsw i64 %35, 1000
store i64 %36, i64* %10
%37 = load i64, i64* %11
%38 = add nsw i64 %37, 1000
store i64 %38, i64* %11
%39 = load i64, i64* %12
%40 = add nsw i64 %39, 1000
store i64 %40, i64* %12
%41 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 0
%42 = load i64, i64* %9
%43 = call i32 @sprintf(i8* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %42)
%44 = getelementptr inbounds [10 x i8], [10 x i8]* %18, i64 0, i64 0
%45 = load i64, i64* %10
%46 = call i32 @sprintf(i8* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %45)
%47 = getelementptr inbounds [10 x i8], [10 x i8]* %19, i64 0, i64 0
%48 = load i64, i64* %11
%49 = call i32 @sprintf(i8* %47, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %48)
%50 = getelementptr inbounds [10 x i8], [10 x i8]* %20, i64 0, i64 0
%51 = load i64, i64* %12
%52 = call i32 @sprintf(i8* %50, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %51)
%53 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 0
%54 = load i32*, i32** %13
%55 = call i32 @fputs(i8* %53, i32* %54)
%56 = getelementptr inbounds [10 x i8], [10 x i8]* %18, i64 0, i64 0
%57 = load i32*, i32** %14
%58 = call i32 @fputs(i8* %56, i32* %57)
%59 = getelementptr inbounds [10 x i8], [10 x i8]* %19, i64 0, i64 0
%60 = load i32*, i32** %15
%61 = call i32 @fputs(i8* %59, i32* %60)
%62 = getelementptr inbounds [10 x i8], [10 x i8]* %20, i64 0, i64 0
%63 = load i32*, i32** %16
%64 = call i32 @fputs(i8* %62, i32* %63)
ret void
}

LLVM IR (-O2):
@__const.set_pwm_speed.speed_c4 = [10 x i8] c"PWM_SPEED\00"
@.str = [4 x i8] c"%ld\00"
define void @set_pwm_speed(i64 %0, i64 %1, i64 %2, i64 %3, i32* nocapture %4, i32* nocapture %5, i32* nocapture %6, i32* nocapture %7) {
%9 = alloca [10 x i8]
%10 = alloca [10 x i8]
%11 = alloca [10 x i8]
%12 = alloca [10 x i8]
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %10, i64 0, i64 0
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %11, i64 0, i64 0
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %12, i64 0, i64 0
%17 = tail call i32 @rewind(i32* %4)
%18 = tail call i32 @rewind(i32* %5)
%19 = tail call i32 @rewind(i32* %6)
%20 = tail call i32 @rewind(i32* %7)
%21 = add nsw i64 %0, 1000
%22 = add nsw i64 %1, 1000
%23 = add nsw i64 %2, 1000
%24 = add nsw i64 %3, 1000
%25 = call i32 @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %21)
%26 = call i32 @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %22)
%27 = call i32 @sprintf(i8* %15, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %23)
%28 = call i32 @sprintf(i8* %16, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %24)
%29 = call i32 @fputs(i8* %13, i32* %4)
%30 = call i32 @fputs(i8* %14, i32* %5)
%31 = call i32 @fputs(i8* %15, i32* %6)
%32 = call i32 @fputs(i8* %16, i32* %7)
ret void
}