#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*/ _dbprintf(char *, char *, int, unsigned short);
scalar_t__ ishouse(unsigned char);
scalar_t__ strcmp(char *, char *);
char *strtok(int /*<<< orphan*/ *, char *);
unsigned short gethousecodes(void) {
  char *parm;
  unsigned char house;
  unsigned short rc = 0;
  parm = strtok(NULL, " ");
  if (!parm || *parm == '\0')
    return 0;
  if (strcmp(parm, "*") == 0)
    return 0xFFFF;
  while ((house = *parm++)) {
    _dbprintf("house %c\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/SensorFlare/mochad/refs/heads/master/"
              "encode.c",
              351, house);
    if (ishouse(house)) {
      house -= 'A';
      _dbprintf("house %d\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/SensorFlare/mochad/refs/"
                "heads/master/encode.c",
                354, house);
      rc |= (1 << house);
      _dbprintf("rc %04X\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/SensorFlare/mochad/refs/"
                "heads/master/encode.c",
                356, rc);
    }
  }
  return rc;
}


x86 assembly (clang, -O0):
<gethousecodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movw   $0x0,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xea7(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     117d <gethousecodes+0x3d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1188 <gethousecodes+0x48>
movw   $0x0,-0x2(%rbp)
jmp    1269 <gethousecodes+0x129>
mov    -0x10(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ad <gethousecodes+0x6d>
movw   $0xffff,-0x2(%rbp)
jmp    1269 <gethousecodes+0x129>
jmp    11b2 <gethousecodes+0x72>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
cmp    $0x0,%al
je     1261 <gethousecodes+0x121>
movzbl -0x11(%rbp),%eax
lea    0xe2b(%rip),%rdi
lea    0xe2e(%rip),%rsi
mov    $0x15f,%edx
movzwl %ax,%ecx
call   1030 <_dbprintf@plt>
movzbl -0x11(%rbp),%edi
call   1050 <ishouse@plt>
cmp    $0x0,%rax
je     125c <gethousecodes+0x11c>
movzbl -0x11(%rbp),%eax
sub    $0x41,%eax
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
lea    0xe81(%rip),%rdi
lea    0xdf2(%rip),%rsi
mov    $0x162,%edx
movzwl %ax,%ecx
call   1030 <_dbprintf@plt>
movzbl -0x11(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
movzwl -0x14(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0x14(%rbp)
lea    0xe59(%rip),%rdi
lea    0xdc0(%rip),%rsi
mov    $0x164,%edx
movzwl -0x14(%rbp),%ecx
call   1030 <_dbprintf@plt>
jmp    11b2 <gethousecodes+0x72>
mov    -0x14(%rbp),%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gethousecodes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%rsi
xor    %r14d,%r14d
xor    %edi,%edi
call   1060 <strtok@plt>
test   %rax,%rax
je     1228 <gethousecodes+0xe8>
mov    %rax,%r15
cmpb   $0x0,(%rax)
je     121e <gethousecodes+0xde>
lea    0xe8a(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1223 <gethousecodes+0xe3>
mov    (%r15),%bl
test   %bl,%bl
je     121e <gethousecodes+0xde>
add    $0x1,%r15
xor    %r14d,%r14d
lea    0xe6c(%rip),%r12
jmp    11bc <gethousecodes+0x7c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%r15),%ebx
add    $0x1,%r15
test   %bl,%bl
je     1228 <gethousecodes+0xe8>
movzbl %bl,%r13d
lea    0xe3d(%rip),%rdi
mov    %r12,%rsi
mov    $0x15f,%edx
mov    %r13d,%ecx
call   1030 <_dbprintf@plt>
mov    %r13d,%edi
call   1050 <ishouse@plt>
test   %rax,%rax
je     11b0 <gethousecodes+0x70>
add    $0xbf,%bl
movzbl %bl,%ebp
lea    0xea5(%rip),%rdi
mov    %r12,%rsi
mov    $0x162,%edx
mov    %ebp,%ecx
call   1030 <_dbprintf@plt>
bts    %ebp,%r14d
movzwl %r14w,%ecx
lea    0xe91(%rip),%rdi
mov    %r12,%rsi
mov    $0x164,%edx
call   1030 <_dbprintf@plt>
jmp    11b0 <gethousecodes+0x70>
xor    %r14d,%r14d
jmp    1228 <gethousecodes+0xe8>
mov    $0xffff,%r14w
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [10 x i8] c"house %c\0A\00"
@.str.3 = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/SensorFlare/mochad/refs/heads/master/encode.c\00"
@.str.4 = [10 x i8] c"house %d\0A\00"
@.str.5 = [9 x i8] c"rc %04X\0A\00"
define zeroext i16 @gethousecodes() {
%1 = alloca i16
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i16
store i16 0, i16* %4
%5 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %8, %0
store i16 0, i16* %1
br label %52
14: ; preds = %8
%15 = load i8*, i8** %2
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %14
store i16 -1, i16* %1
br label %52
19: ; preds = %14
br label %20
20: ; preds = %49, %19
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %2
%23 = load i8, i8* %21
store i8 %23, i8* %3
%24 = icmp ne i8 %23, 0
br i1 %24, label %25, label %50
25: ; preds = %20
%26 = load i8, i8* %3
%27 = zext i8 %26 to i16
%28 = call i32 @_dbprintf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.3, i64 0, i64 0), i32 351, i16 zeroext %27)
%29 = load i8, i8* %3
%30 = call i64 @ishouse(i8 zeroext %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %49
32: ; preds = %25
%33 = load i8, i8* %3
%34 = zext i8 %33 to i32
%35 = sub nsw i32 %34, 65
%36 = trunc i32 %35 to i8
store i8 %36, i8* %3
%37 = load i8, i8* %3
%38 = zext i8 %37 to i16
%39 = call i32 @_dbprintf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.3, i64 0, i64 0), i32 354, i16 zeroext %38)
%40 = load i8, i8* %3
%41 = zext i8 %40 to i32
%42 = shl i32 1, %41
%43 = load i16, i16* %4
%44 = zext i16 %43 to i32
%45 = or i32 %44, %42
%46 = trunc i32 %45 to i16
store i16 %46, i16* %4
%47 = load i16, i16* %4
%48 = call i32 @_dbprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.3, i64 0, i64 0), i32 356, i16 zeroext %47)
br label %49
49: ; preds = %32, %25
br label %20
50: ; preds = %20
%51 = load i16, i16* %4
store i16 %51, i16* %1
br label %52
52: ; preds = %50, %18, %13
%53 = load i16, i16* %1
ret i16 %53
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [10 x i8] c"house %c\0A\00"
@.str.3 = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/SensorFlare/mochad/refs/heads/master/encode.c\00"
@.str.4 = [10 x i8] c"house %d\0A\00"
@.str.5 = [9 x i8] c"rc %04X\0A\00"
define zeroext i16 @gethousecodes() {
%1 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %34, label %3
3: ; preds = %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %34, label %6
6: ; preds = %3
%7 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %34, label %9
9: ; preds = %6
%10 = load i8, i8* %1
%11 = icmp eq i8 %10, 0
br i1 %11, label %34, label %12
12: ; preds = %9, %30
%13 = phi i8 [ %32, %30 ], [ %10, %9 ]
%14 = phi i8* [ %16, %30 ], [ %1, %9 ]
%15 = phi i16 [ %31, %30 ], [ 0, %9 ]
%16 = getelementptr inbounds i8, i8* %14, i64 1
%17 = zext i8 %13 to i16
%18 = tail call i32 @_dbprintf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.3, i64 0, i64 0), i32 351, i16 zeroext %17)
%19 = tail call i64 @ishouse(i8 zeroext %13)
%20 = icmp eq i64 %19, 0
br i1 %20, label %30, label %21
21: ; preds = %12
%22 = add i8 %13, -65
%23 = zext i8 %22 to i16
%24 = tail call i32 @_dbprintf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.3, i64 0, i64 0), i32 354, i16 zeroext %23)
%25 = zext i8 %22 to i32
%26 = shl nuw i32 1, %25
%27 = trunc i32 %26 to i16
%28 = or i16 %15, %27
%29 = tail call i32 @_dbprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.3, i64 0, i64 0), i32 356, i16 zeroext %28)
br label %30
30: ; preds = %21, %12
%31 = phi i16 [ %28, %21 ], [ %15, %12 ]
%32 = load i8, i8* %16
%33 = icmp eq i8 %32, 0
br i1 %33, label %34, label %12
34: ; preds = %30, %9, %6, %0, %3
%35 = phi i16 [ 0, %3 ], [ 0, %0 ], [ -1, %6 ], [ 0, %9 ], [ %31, %30 ]
ret i16 %35
}