#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 */
struct city {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ i_commercial(struct city *, char *);
int /*<<< orphan*/ i_industrial(struct city *, char *);
int /*<<< orphan*/ i_residential(struct city *, char *);
int /*<<< orphan*/ printf(char *);
char *strstr(char *, char *);
int decode_line(struct city *the_city, char *line) {
  if (strstr(line, "#") == line) {
    printf("Found a comment\n");
    return 1;
  }
  if (strstr(line, "resid") == line) {
    i_residential(the_city, line);
    return 0;
  }
  if (strstr(line, "comme") == line) {
    i_commercial(the_city, line);
    return 0;
  }
  if (strstr(line, "indus") == line) {
    i_industrial(the_city, line);
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<decode_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1070 <strstr@plt>
cmp    -0x18(%rbp),%rax
jne    1192 <decode_line+0x42>
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1232 <decode_line+0xe2>
mov    -0x18(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1070 <strstr@plt>
cmp    -0x18(%rbp),%rax
jne    11c5 <decode_line+0x75>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <i_residential@plt>
movl   $0x0,-0x4(%rbp)
jmp    1232 <decode_line+0xe2>
mov    -0x18(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   1070 <strstr@plt>
cmp    -0x18(%rbp),%rax
jne    11f8 <decode_line+0xa8>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <i_commercial@plt>
movl   $0x0,-0x4(%rbp)
jmp    1232 <decode_line+0xe2>
mov    -0x18(%rbp),%rdi
lea    0xe1c(%rip),%rsi
call   1070 <strstr@plt>
cmp    -0x18(%rbp),%rax
jne    122b <decode_line+0xdb>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <i_industrial@plt>
movl   $0x0,-0x4(%rbp)
jmp    1232 <decode_line+0xe2>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_line>:
push   %r14
push   %rbx
push   %rax
cmpb   $0x23,(%rsi)
jne    116c <decode_line+0x1c>
lea    0xeb2(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
jmp    11e8 <decode_line+0x98>
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xe87(%rip),%rsi
mov    $0x5,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     11ce <decode_line+0x7e>
lea    0xe75(%rip),%rsi
mov    $0x5,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     11db <decode_line+0x8b>
lea    0xe63(%rip),%rsi
mov    $0x5,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
test   %ecx,%ecx
jne    11e8 <decode_line+0x98>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <i_industrial@plt>
jmp    11e6 <decode_line+0x96>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <i_residential@plt>
jmp    11e6 <decode_line+0x96>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <i_commercial@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.city = type { i32 }
@.str = [2 x i8] c"#\00"
@.str.1 = [17 x i8] c"Found a comment\0A\00"
@.str.2 = [6 x i8] c"resid\00"
@.str.3 = [6 x i8] c"comme\00"
@.str.4 = [6 x i8] c"indus\00"
define i32 @decode_line(%struct.city* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.city*
%5 = alloca i8*
store %struct.city* %0, %struct.city** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i8* @strstr(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %5
%9 = icmp eq i8* %7, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %40
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i8* @strstr(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%15 = load i8*, i8** %5
%16 = icmp eq i8* %14, %15
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = load %struct.city*, %struct.city** %4
%19 = load i8*, i8** %5
%20 = call i32 @i_residential(%struct.city* %18, i8* %19)
store i32 0, i32* %3
br label %40
21: ; preds = %12
%22 = load i8*, i8** %5
%23 = call i8* @strstr(i8* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%24 = load i8*, i8** %5
%25 = icmp eq i8* %23, %24
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = load %struct.city*, %struct.city** %4
%28 = load i8*, i8** %5
%29 = call i32 @i_commercial(%struct.city* %27, i8* %28)
store i32 0, i32* %3
br label %40
30: ; preds = %21
%31 = load i8*, i8** %5
%32 = call i8* @strstr(i8* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%33 = load i8*, i8** %5
%34 = icmp eq i8* %32, %33
br i1 %34, label %35, label %39
35: ; preds = %30
%36 = load %struct.city*, %struct.city** %4
%37 = load i8*, i8** %5
%38 = call i32 @i_industrial(%struct.city* %36, i8* %37)
store i32 0, i32* %3
br label %40
39: ; preds = %30
store i32 -1, i32* %3
br label %40
40: ; preds = %39, %35, %26, %17, %10
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
%struct.city = type { i32 }
@.str.2 = [6 x i8] c"resid\00"
@.str.3 = [6 x i8] c"comme\00"
@.str.4 = [6 x i8] c"indus\00"
@str = [16 x i8] c"Found a comment\00"
define i32 @decode_line(%struct.city* %0, i8* %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 35
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %22
7: ; preds = %2
%8 = tail call i32 @strncmp(i8* %1, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 5)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @i_residential(%struct.city* %0, i8* %1)
br label %22
12: ; preds = %7
%13 = tail call i32 @strncmp(i8* %1, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 5)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = tail call i32 @i_commercial(%struct.city* %0, i8* %1)
br label %22
17: ; preds = %12
%18 = tail call i32 @strncmp(i8* %1, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i64 5)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @i_industrial(%struct.city* %0, i8* %1)
br label %22
22: ; preds = %17, %20, %15, %10, %5
%23 = phi i32 [ 1, %5 ], [ 0, %10 ], [ 0, %15 ], [ 0, %20 ], [ -1, %17 ]
ret i32 %23
}