#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 */
char *strchr(char *, char);
void uncomment_cstyle(char *p) {
  char *e;
  if ((e = strchr(p + 2, '*'))) {
    if (*(++e) == '/') {
      e++;
      while (*e)
        *(p++) = *(e++);
    }
  }
  *p = '\0';
}


x86 assembly (clang, -O0):
<uncomment_cstyle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
mov    $0x2a,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     11a2 <uncomment_cstyle+0x92>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0x2f,%eax
jne    119d <uncomment_cstyle+0x8d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1198 <uncomment_cstyle+0x88>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1164 <uncomment_cstyle+0x54>
jmp    119d <uncomment_cstyle+0x8d>
jmp    11a2 <uncomment_cstyle+0x92>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uncomment_cstyle>:
push   %rbx
mov    %rdi,%rbx
add    $0x2,%rdi
mov    $0x2a,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1151 <uncomment_cstyle+0x41>
cmpb   $0x2f,0x1(%rax)
jne    1151 <uncomment_cstyle+0x41>
mov    0x2(%rax),%cl
test   %cl,%cl
je     1151 <uncomment_cstyle+0x41>
add    $0x3,%rax
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rbx)
add    $0x1,%rbx
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1140 <uncomment_cstyle+0x30>
movb   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @uncomment_cstyle(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 2
%6 = call i8* @strchr(i8* %5, i8 signext 42)
store i8* %6, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %29
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 47
br i1 %13, label %14, label %28
14: ; preds = %8
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %3
br label %17
17: ; preds = %21, %14
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = icmp ne i8 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %17
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %3
%24 = load i8, i8* %22
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %2
store i8 %24, i8* %25
br label %17
27: ; preds = %17
br label %28
28: ; preds = %27, %8
br label %29
29: ; preds = %28, %1
%30 = load i8*, i8** %2
store i8 0, i8* %30
ret void
}

LLVM IR (-O2):
define void @uncomment_cstyle(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 2
%3 = tail call i8* @strchr(i8* %2, i8 signext 42)
%4 = icmp eq i8* %3, null
br i1 %4, label %21, label %5
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %3, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 47
br i1 %8, label %9, label %21
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %3, i64 2
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %21, label %13
13: ; preds = %9, %13
%14 = phi i8 [ %19, %13 ], [ %11, %9 ]
%15 = phi i8* [ %17, %13 ], [ %10, %9 ]
%16 = phi i8* [ %18, %13 ], [ %0, %9 ]
%17 = getelementptr inbounds i8, i8* %15, i64 1
%18 = getelementptr inbounds i8, i8* %16, i64 1
store i8 %14, i8* %16
%19 = load i8, i8* %17
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %13
21: ; preds = %13, %9, %5, %1
%22 = phi i8* [ %0, %5 ], [ %0, %1 ], [ %0, %9 ], [ %18, %13 ]
store i8 0, i8* %22
ret void
}