#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 atoi(char const *);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
int createNexaString(const char *pHouseStr, const char *pChannelStr,
                     const char *pOn_offStr, char *pTxStr, int waveman) {
  *pTxStr = '\0';
  int houseCode;
  int channelCode;
  int on_offCode;
  int txCode = 0;
  const int unknownCode = 0x6;
  int bit;
  int bitmask = 0x0001;
  houseCode = (int)((*pHouseStr) - 65);
  channelCode = atoi(pChannelStr) - 1;
  on_offCode = atoi(pOn_offStr);
  if ((houseCode < 0) || (houseCode > 15) || (channelCode < 0) ||
      (channelCode > 15) || (on_offCode < 0) || (on_offCode > 1)) {
  } else {
    txCode = houseCode;
    txCode |= (channelCode << 4);
    if (waveman && on_offCode == 0) {
    } else {
      txCode |= (unknownCode << 8);
      txCode |= (on_offCode << 11);
    }
    strcat(pTxStr, "S");
    for (bit = 0; bit < 12; bit++) {
      if ((bitmask & txCode) == 0) {
        strcat(pTxStr, " ` `");
      } else {
        strcat(pTxStr, " `` ");
      }
      bitmask = bitmask << 1;
    }
    strcat(pTxStr, " }+");
  }
  return strlen(pTxStr);
}


x86 assembly (clang, -O0):
<createNexaString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x34(%rbp)
movl   $0x6,-0x38(%rbp)
movl   $0x1,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <atoi@plt>
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x28(%rbp)
jl     11cc <createNexaString+0x9c>
cmpl   $0xf,-0x28(%rbp)
jg     11cc <createNexaString+0x9c>
cmpl   $0x0,-0x2c(%rbp)
jl     11cc <createNexaString+0x9c>
cmpl   $0xf,-0x2c(%rbp)
jg     11cc <createNexaString+0x9c>
cmpl   $0x0,-0x30(%rbp)
jl     11cc <createNexaString+0x9c>
cmpl   $0x1,-0x30(%rbp)
jle    11d1 <createNexaString+0xa1>
jmp    128f <createNexaString+0x15f>
mov    -0x28(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
shl    $0x4,%eax
or     -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11fc <createNexaString+0xcc>
cmpl   $0x0,-0x30(%rbp)
jne    11fc <createNexaString+0xcc>
jmp    1213 <createNexaString+0xe3>
mov    -0x34(%rbp),%eax
or     $0x600,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
shl    $0xb,%eax
or     -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xde2(%rip),%rsi
call   1050 <strcat@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0xc,-0x3c(%rbp)
jge    127f <createNexaString+0x14f>
mov    -0x40(%rbp),%eax
and    -0x34(%rbp),%eax
cmp    $0x0,%eax
jne    1258 <createNexaString+0x128>
mov    -0x20(%rbp),%rdi
lea    0xdb4(%rip),%rsi
call   1050 <strcat@plt>
jmp    1268 <createNexaString+0x138>
mov    -0x20(%rbp),%rdi
lea    0xda4(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x40(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    122a <createNexaString+0xfa>
mov    -0x20(%rbp),%rdi
lea    0xd82(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createNexaString>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r15d
mov    %rcx,%r14
mov    %rdx,%rbx
movb   $0x0,(%rcx)
movzbl (%rdi),%r12d
mov    %rsi,%rdi
call   1040 <atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <atoi@plt>
lea    -0x51(%r12),%ecx
cmp    $0xf0,%cl
jb     12c7 <createNexaString+0x197>
test   %ebp,%ebp
jle    12c7 <createNexaString+0x197>
cmp    $0x10,%ebp
jg     12c7 <createNexaString+0x197>
test   %eax,%eax
js     12c7 <createNexaString+0x197>
cmp    $0x1,%eax
jg     12c7 <createNexaString+0x197>
add    $0xffffffbf,%r12d
shl    $0x4,%ebp
add    $0xfffffff0,%ebp
or     %r12d,%ebp
mov    %eax,%ecx
shl    $0xb,%ecx
or     %ebp,%ecx
or     $0x600,%ecx
test   %eax,%eax
cmovne %ecx,%ebp
test   %r15d,%r15d
cmove  %ecx,%ebp
lea    0xe4a(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
test   $0x1,%bpl
lea    0xe39(%rip),%r15
lea    0xe37(%rip),%rbx
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
test   $0x2,%bpl
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
test   $0x4,%bpl
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
test   $0x8,%bpl
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
test   $0x10,%bpl
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
test   $0x20,%bpl
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
test   $0x40,%bpl
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
test   $0x80,%bpl
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
test   $0x100,%ebp
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
test   $0x200,%ebp
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
test   $0x400,%ebp
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
test   $0x800,%ebp
cmove  %r15,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcat@plt>
lea    0xd4d(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <strlen@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"S\00"
@.str.1 = [5 x i8] c" ` `\00"
@.str.2 = [5 x i8] c" `` \00"
@.str.3 = [4 x i8] c" }+\00"
define i32 @createNexaString(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%18 = load i8*, i8** %9
store i8 0, i8* %18
store i32 0, i32* %14
store i32 6, i32* %15
store i32 1, i32* %17
%19 = load i8*, i8** %6
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = sub nsw i32 %21, 65
store i32 %22, i32* %11
%23 = load i8*, i8** %7
%24 = call i32 @atoi(i8* %23)
%25 = sub nsw i32 %24, 1
store i32 %25, i32* %12
%26 = load i8*, i8** %8
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %13
%28 = load i32, i32* %11
%29 = icmp slt i32 %28, 0
br i1 %29, label %45, label %30
30: ; preds = %5
%31 = load i32, i32* %11
%32 = icmp sgt i32 %31, 15
br i1 %32, label %45, label %33
33: ; preds = %30
%34 = load i32, i32* %12
%35 = icmp slt i32 %34, 0
br i1 %35, label %45, label %36
36: ; preds = %33
%37 = load i32, i32* %12
%38 = icmp sgt i32 %37, 15
br i1 %38, label %45, label %39
39: ; preds = %36
%40 = load i32, i32* %13
%41 = icmp slt i32 %40, 0
br i1 %41, label %45, label %42
42: ; preds = %39
%43 = load i32, i32* %13
%44 = icmp sgt i32 %43, 1
br i1 %44, label %45, label %46
45: ; preds = %42, %39, %36, %33, %30, %5
br label %91
46: ; preds = %42
%47 = load i32, i32* %11
store i32 %47, i32* %14
%48 = load i32, i32* %12
%49 = shl i32 %48, 4
%50 = load i32, i32* %14
%51 = or i32 %50, %49
store i32 %51, i32* %14
%52 = load i32, i32* %10
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %58
54: ; preds = %46
%55 = load i32, i32* %13
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %54
br label %65
58: ; preds = %54, %46
%59 = load i32, i32* %14
%60 = or i32 %59, 1536
store i32 %60, i32* %14
%61 = load i32, i32* %13
%62 = shl i32 %61, 11
%63 = load i32, i32* %14
%64 = or i32 %63, %62
store i32 %64, i32* %14
br label %65
65: ; preds = %58, %57
%66 = load i8*, i8** %9
%67 = call i32 @strcat(i8* %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %16
br label %68
68: ; preds = %85, %65
%69 = load i32, i32* %16
%70 = icmp slt i32 %69, 12
br i1 %70, label %71, label %88
71: ; preds = %68
%72 = load i32, i32* %17
%73 = load i32, i32* %14
%74 = and i32 %72, %73
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %71
%77 = load i8*, i8** %9
%78 = call i32 @strcat(i8* %77, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %82
79: ; preds = %71
%80 = load i8*, i8** %9
%81 = call i32 @strcat(i8* %80, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %82
82: ; preds = %79, %76
%83 = load i32, i32* %17
%84 = shl i32 %83, 1
store i32 %84, i32* %17
br label %85
85: ; preds = %82
%86 = load i32, i32* %16
%87 = add nsw i32 %86, 1
store i32 %87, i32* %16
br label %68
88: ; preds = %68
%89 = load i8*, i8** %9
%90 = call i32 @strcat(i8* %89, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %91
91: ; preds = %88, %45
%92 = load i8*, i8** %9
%93 = call i32 @strlen(i8* %92)
ret i32 %93
}

LLVM IR (-O2):
@.str = [2 x i8] c"S\00"
@.str.1 = [5 x i8] c" ` `\00"
@.str.2 = [5 x i8] c" `` \00"
@.str.3 = [4 x i8] c" }+\00"
define i32 @createNexaString(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2, i8* %3, i32 %4) {
store i8 0, i8* %3
%6 = load i8, i8* %0
%7 = tail call i32 @atoi(i8* %1)
%8 = tail call i32 @atoi(i8* %2)
%9 = add i8 %6, -81
%10 = icmp ult i8 %9, -16
%11 = icmp slt i32 %7, 1
%12 = select i1 %10, i1 true, i1 %11
%13 = icmp sgt i32 %7, 16
%14 = select i1 %12, i1 true, i1 %13
%15 = icmp slt i32 %8, 0
%16 = select i1 %14, i1 true, i1 %15
%17 = icmp sgt i32 %8, 1
%18 = select i1 %16, i1 true, i1 %17
br i1 %18, label %82, label %19
19: ; preds = %5
%20 = zext i8 %6 to i32
%21 = add nsw i32 %20, -65
%22 = shl nuw nsw i32 %7, 4
%23 = add nsw i32 %22, -16
%24 = or i32 %23, %21
%25 = icmp ne i32 %4, 0
%26 = icmp eq i32 %8, 0
%27 = select i1 %25, i1 %26, i1 false
%28 = shl nuw nsw i32 %8, 11
%29 = or i32 %28, %24
%30 = or i32 %29, 1536
%31 = select i1 %27, i32 %24, i32 %30
%32 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%33 = and i32 %31, 1
%34 = icmp eq i32 %33, 0
%35 = select i1 %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%36 = tail call i32 @strcat(i8* %3, i8* %35)
%37 = and i32 %31, 2
%38 = icmp eq i32 %37, 0
%39 = select i1 %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%40 = tail call i32 @strcat(i8* %3, i8* %39)
%41 = and i32 %31, 4
%42 = icmp eq i32 %41, 0
%43 = select i1 %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%44 = tail call i32 @strcat(i8* %3, i8* %43)
%45 = and i32 %31, 8
%46 = icmp eq i32 %45, 0
%47 = select i1 %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%48 = tail call i32 @strcat(i8* %3, i8* %47)
%49 = and i32 %31, 16
%50 = icmp eq i32 %49, 0
%51 = select i1 %50, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%52 = tail call i32 @strcat(i8* %3, i8* %51)
%53 = and i32 %31, 32
%54 = icmp eq i32 %53, 0
%55 = select i1 %54, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%56 = tail call i32 @strcat(i8* %3, i8* %55)
%57 = and i32 %31, 64
%58 = icmp eq i32 %57, 0
%59 = select i1 %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%60 = tail call i32 @strcat(i8* %3, i8* %59)
%61 = and i32 %31, 128
%62 = icmp eq i32 %61, 0
%63 = select i1 %62, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%64 = tail call i32 @strcat(i8* %3, i8* %63)
%65 = and i32 %31, 256
%66 = icmp eq i32 %65, 0
%67 = select i1 %66, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%68 = tail call i32 @strcat(i8* %3, i8* %67)
%69 = and i32 %31, 512
%70 = icmp eq i32 %69, 0
%71 = select i1 %70, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%72 = tail call i32 @strcat(i8* %3, i8* %71)
%73 = and i32 %31, 1024
%74 = icmp eq i32 %73, 0
%75 = select i1 %74, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%76 = tail call i32 @strcat(i8* %3, i8* %75)
%77 = and i32 %31, 2048
%78 = icmp eq i32 %77, 0
%79 = select i1 %78, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%80 = tail call i32 @strcat(i8* %3, i8* %79)
%81 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %82
82: ; preds = %5, %19
%83 = tail call i32 @strlen(i8* %3)
ret i32 %83
}