#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 u_int8_t;

/* Variables and functions */
int TCPI_OPT_ECN;
int TCPI_OPT_SACK;
int TCPI_OPT_TIMESTAMPS;
int TCPI_OPT_WSCALE;
int /*<<< orphan*/ strcat(char *, char *);
void decode_tcp_options(char *options_text, u_int8_t tcp_options) {
  if ((tcp_options & TCPI_OPT_TIMESTAMPS)) {
    strcat(options_text, "Timestamps ");
  }
  if ((tcp_options & TCPI_OPT_SACK)) {
    strcat(options_text, "SACK ");
  }
  if ((tcp_options & TCPI_OPT_WSCALE)) {
    strcat(options_text, "Window Scaling ");
  }
  if ((tcp_options & TCPI_OPT_ECN)) {
    strcat(options_text, "ECN ");
  }
  return;
}


x86 assembly (clang, -O0):
<decode_tcp_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e9f(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1144 <decode_tcp_options+0x34>
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1030 <strcat@plt>
mov    -0xc(%rbp),%eax
mov    0x2e9a(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1169 <decode_tcp_options+0x59>
mov    -0x8(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1030 <strcat@plt>
mov    -0xc(%rbp),%eax
mov    0x2e5d(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     118e <decode_tcp_options+0x7e>
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1030 <strcat@plt>
mov    -0xc(%rbp),%eax
mov    0x2e40(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11b3 <decode_tcp_options+0xa3>
mov    -0x8(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1030 <strcat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_tcp_options>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2ea9(%rip),%rax
test   %esi,(%rax)
je     1132 <decode_tcp_options+0x22>
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
mov    0x2eaf(%rip),%rax
test   %ebp,(%rax)
je     114c <decode_tcp_options+0x3c>
lea    0xec8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
mov    0x2e7d(%rip),%rax
test   %ebp,(%rax)
je     1166 <decode_tcp_options+0x56>
lea    0xeb4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
mov    0x2e6b(%rip),%rax
test   %ebp,(%rax)
je     1186 <decode_tcp_options+0x76>
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <strcat@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@TCPI_OPT_TIMESTAMPS = global i32 0
@.str = [12 x i8] c"Timestamps \00"
@TCPI_OPT_SACK = global i32 0
@.str.1 = [6 x i8] c"SACK \00"
@TCPI_OPT_WSCALE = global i32 0
@.str.2 = [16 x i8] c"Window Scaling \00"
@TCPI_OPT_ECN = global i32 0
@.str.3 = [5 x i8] c"ECN \00"
define void @decode_tcp_options(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* @TCPI_OPT_TIMESTAMPS
%7 = and i32 %5, %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %2
%13 = load i32, i32* %4
%14 = load i32, i32* @TCPI_OPT_SACK
%15 = and i32 %13, %14
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = call i32 @strcat(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %17, %12
%21 = load i32, i32* %4
%22 = load i32, i32* @TCPI_OPT_WSCALE
%23 = and i32 %21, %22
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i8*, i8** %3
%27 = call i32 @strcat(i8* %26, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %25, %20
%29 = load i32, i32* %4
%30 = load i32, i32* @TCPI_OPT_ECN
%31 = and i32 %29, %30
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = load i8*, i8** %3
%35 = call i32 @strcat(i8* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %36
36: ; preds = %33, %28
ret void
}

LLVM IR (-O2):
@TCPI_OPT_TIMESTAMPS = global i32 0
@.str = [12 x i8] c"Timestamps \00"
@TCPI_OPT_SACK = global i32 0
@.str.1 = [6 x i8] c"SACK \00"
@TCPI_OPT_WSCALE = global i32 0
@.str.2 = [16 x i8] c"Window Scaling \00"
@TCPI_OPT_ECN = global i32 0
@.str.3 = [5 x i8] c"ECN \00"
define void @decode_tcp_options(i8* %0, i32 %1) {
%3 = load i32, i32* @TCPI_OPT_TIMESTAMPS
%4 = and i32 %3, %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
%9 = load i32, i32* @TCPI_OPT_SACK
%10 = and i32 %9, %1
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
%15 = load i32, i32* @TCPI_OPT_WSCALE
%16 = and i32 %15, %1
%17 = icmp eq i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %14
%19 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %14
%21 = load i32, i32* @TCPI_OPT_ECN
%22 = and i32 %21, %1
%23 = icmp eq i32 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %20
%25 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %24, %20
ret void
}