#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 /*<<< orphan*/ xcrc_set(char *, int);
int xcmd_surge_focus(char *buffer) {
  int len = 0;
  buffer[len++] = 0x7E;
  buffer[len++] = 0x42;
  buffer[len++] = 0xFF;
  buffer[len++] = 0xFF;
  buffer[len++] = 18;
  buffer[len++] = 0x82;
  buffer[len++] = 10;
  buffer[len++] = 0x7d;
  buffer[len++] = 0x5e;
  buffer[len++] = 0x00;
  buffer[len++] = 0x00;
  buffer[len++] = 0x00;
  buffer[len++] = 0x00;
  buffer[len++] = 0x01;
  buffer[len++] = 0x00;
  buffer[len++] = 0x01;
  buffer[len++] = 0x00;
  buffer[len++] = 0x05;
  buffer[len++] = 0x00;
  buffer[len++] = 0x00;
  buffer[len++] = 0x79;
  buffer[len++] = 0x89;
  len += 2;
  xcrc_set(buffer, len);
  buffer[len++] = 0x7E;
  return len;
}


x86 assembly (clang, -O0):
<xcmd_surge_focus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x7e,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x42,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x12,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x82,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0xa,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x7d,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x5e,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x1,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x1,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x5,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x79,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x89,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <xcrc_set@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x7e,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcmd_surge_focus>:
push   %rbx
mov    %rdi,%rbx
movabs $0x7d0a8212ffff427e,%rax
82 0a 7d
mov    %rax,(%rdi)
movb   $0x5e,0x8(%rdi)
movl   $0x0,0x9(%rdi)
movabs $0x7900000500010001,%rax
mov    %rax,0xd(%rdi)
movb   $0x89,0x15(%rdi)
mov    $0x18,%esi
call   1030 <xcrc_set@plt>
movb   $0x7e,0x18(%rbx)
mov    $0x19,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @xcmd_surge_focus(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = load i32, i32* %3
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds i8, i8* %4, i64 %7
store i8 126, i8* %8
%9 = load i8*, i8** %2
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
%12 = sext i32 %10 to i64
%13 = getelementptr inbounds i8, i8* %9, i64 %12
store i8 66, i8* %13
%14 = load i8*, i8** %2
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
%17 = sext i32 %15 to i64
%18 = getelementptr inbounds i8, i8* %14, i64 %17
store i8 -1, i8* %18
%19 = load i8*, i8** %2
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
%22 = sext i32 %20 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
store i8 -1, i8* %23
%24 = load i8*, i8** %2
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
%27 = sext i32 %25 to i64
%28 = getelementptr inbounds i8, i8* %24, i64 %27
store i8 18, i8* %28
%29 = load i8*, i8** %2
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
%32 = sext i32 %30 to i64
%33 = getelementptr inbounds i8, i8* %29, i64 %32
store i8 -126, i8* %33
%34 = load i8*, i8** %2
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
%37 = sext i32 %35 to i64
%38 = getelementptr inbounds i8, i8* %34, i64 %37
store i8 10, i8* %38
%39 = load i8*, i8** %2
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
%42 = sext i32 %40 to i64
%43 = getelementptr inbounds i8, i8* %39, i64 %42
store i8 125, i8* %43
%44 = load i8*, i8** %2
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
%47 = sext i32 %45 to i64
%48 = getelementptr inbounds i8, i8* %44, i64 %47
store i8 94, i8* %48
%49 = load i8*, i8** %2
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
%52 = sext i32 %50 to i64
%53 = getelementptr inbounds i8, i8* %49, i64 %52
store i8 0, i8* %53
%54 = load i8*, i8** %2
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
%57 = sext i32 %55 to i64
%58 = getelementptr inbounds i8, i8* %54, i64 %57
store i8 0, i8* %58
%59 = load i8*, i8** %2
%60 = load i32, i32* %3
%61 = add nsw i32 %60, 1
store i32 %61, i32* %3
%62 = sext i32 %60 to i64
%63 = getelementptr inbounds i8, i8* %59, i64 %62
store i8 0, i8* %63
%64 = load i8*, i8** %2
%65 = load i32, i32* %3
%66 = add nsw i32 %65, 1
store i32 %66, i32* %3
%67 = sext i32 %65 to i64
%68 = getelementptr inbounds i8, i8* %64, i64 %67
store i8 0, i8* %68
%69 = load i8*, i8** %2
%70 = load i32, i32* %3
%71 = add nsw i32 %70, 1
store i32 %71, i32* %3
%72 = sext i32 %70 to i64
%73 = getelementptr inbounds i8, i8* %69, i64 %72
store i8 1, i8* %73
%74 = load i8*, i8** %2
%75 = load i32, i32* %3
%76 = add nsw i32 %75, 1
store i32 %76, i32* %3
%77 = sext i32 %75 to i64
%78 = getelementptr inbounds i8, i8* %74, i64 %77
store i8 0, i8* %78
%79 = load i8*, i8** %2
%80 = load i32, i32* %3
%81 = add nsw i32 %80, 1
store i32 %81, i32* %3
%82 = sext i32 %80 to i64
%83 = getelementptr inbounds i8, i8* %79, i64 %82
store i8 1, i8* %83
%84 = load i8*, i8** %2
%85 = load i32, i32* %3
%86 = add nsw i32 %85, 1
store i32 %86, i32* %3
%87 = sext i32 %85 to i64
%88 = getelementptr inbounds i8, i8* %84, i64 %87
store i8 0, i8* %88
%89 = load i8*, i8** %2
%90 = load i32, i32* %3
%91 = add nsw i32 %90, 1
store i32 %91, i32* %3
%92 = sext i32 %90 to i64
%93 = getelementptr inbounds i8, i8* %89, i64 %92
store i8 5, i8* %93
%94 = load i8*, i8** %2
%95 = load i32, i32* %3
%96 = add nsw i32 %95, 1
store i32 %96, i32* %3
%97 = sext i32 %95 to i64
%98 = getelementptr inbounds i8, i8* %94, i64 %97
store i8 0, i8* %98
%99 = load i8*, i8** %2
%100 = load i32, i32* %3
%101 = add nsw i32 %100, 1
store i32 %101, i32* %3
%102 = sext i32 %100 to i64
%103 = getelementptr inbounds i8, i8* %99, i64 %102
store i8 0, i8* %103
%104 = load i8*, i8** %2
%105 = load i32, i32* %3
%106 = add nsw i32 %105, 1
store i32 %106, i32* %3
%107 = sext i32 %105 to i64
%108 = getelementptr inbounds i8, i8* %104, i64 %107
store i8 121, i8* %108
%109 = load i8*, i8** %2
%110 = load i32, i32* %3
%111 = add nsw i32 %110, 1
store i32 %111, i32* %3
%112 = sext i32 %110 to i64
%113 = getelementptr inbounds i8, i8* %109, i64 %112
store i8 -119, i8* %113
%114 = load i32, i32* %3
%115 = add nsw i32 %114, 2
store i32 %115, i32* %3
%116 = load i8*, i8** %2
%117 = load i32, i32* %3
%118 = call i32 @xcrc_set(i8* %116, i32 %117)
%119 = load i8*, i8** %2
%120 = load i32, i32* %3
%121 = add nsw i32 %120, 1
store i32 %121, i32* %3
%122 = sext i32 %120 to i64
%123 = getelementptr inbounds i8, i8* %119, i64 %122
store i8 126, i8* %123
%124 = load i32, i32* %3
ret i32 %124
}

LLVM IR (-O2):
define i32 @xcmd_surge_focus(i8* %0) {
store i8 126, i8* %0
%2 = getelementptr inbounds i8, i8* %0, i64 1
store i8 66, i8* %2
%3 = getelementptr inbounds i8, i8* %0, i64 2
store i8 -1, i8* %3
%4 = getelementptr inbounds i8, i8* %0, i64 3
store i8 -1, i8* %4
%5 = getelementptr inbounds i8, i8* %0, i64 4
store i8 18, i8* %5
%6 = getelementptr inbounds i8, i8* %0, i64 5
store i8 -126, i8* %6
%7 = getelementptr inbounds i8, i8* %0, i64 6
store i8 10, i8* %7
%8 = getelementptr inbounds i8, i8* %0, i64 7
store i8 125, i8* %8
%9 = getelementptr inbounds i8, i8* %0, i64 8
store i8 94, i8* %9
%10 = getelementptr inbounds i8, i8* %0, i64 9
%11 = getelementptr inbounds i8, i8* %0, i64 13
%12 = bitcast i8* %10 to i32*
store i32 0, i32* %12
store i8 1, i8* %11
%13 = getelementptr inbounds i8, i8* %0, i64 14
store i8 0, i8* %13
%14 = getelementptr inbounds i8, i8* %0, i64 15
store i8 1, i8* %14
%15 = getelementptr inbounds i8, i8* %0, i64 16
store i8 0, i8* %15
%16 = getelementptr inbounds i8, i8* %0, i64 17
store i8 5, i8* %16
%17 = getelementptr inbounds i8, i8* %0, i64 18
store i8 0, i8* %17
%18 = getelementptr inbounds i8, i8* %0, i64 19
store i8 0, i8* %18
%19 = getelementptr inbounds i8, i8* %0, i64 20
store i8 121, i8* %19
%20 = getelementptr inbounds i8, i8* %0, i64 21
store i8 -119, i8* %20
%21 = tail call i32 @xcrc_set(i8* %0, i32 24)
%22 = getelementptr inbounds i8, i8* %0, i64 24
store i8 126, i8* %22
ret i32 25
}