#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*/ foo(char *, char **);
int main(void) {
  char str[] = "foo { xx }";
  char *ptr = str + 5;
  foo(ptr, &ptr);
  while (*ptr && (*ptr == 13 || *ptr == 32))
    ptr++;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0xf(%rbp)
mov    0xed7(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xecf(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0xf(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <foo@plt>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1197 <main+0x87>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0xd,%ecx
mov    %al,-0x1a(%rbp)
je     1191 <main+0x81>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11a7 <main+0x97>
jmp    11b8 <main+0xa8>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1157 <main+0x47>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x7878207b206f6f66,%rax
20 78 78
mov    %rax,0x8(%rsp)
movl   $0x7d2078,0xf(%rsp)
lea    0xd(%rsp),%rdi
mov    %rdi,(%rsp)
mov    %rsp,%rsi
call   1030 <foo@plt>
mov    (%rsp),%rax
jmp    1154 <main+0x44>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rax,(%rsp)
add    $0x1,%rax
movzbl -0x1(%rax),%ecx
cmp    $0x20,%cl
je     1150 <main+0x40>
cmp    $0xd,%cl
je     1150 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.str = [11 x i8] c"foo { xx }\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = bitcast [11 x i8]* %2 to i8*
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds i8, i8* %5, i64 5
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @foo(i8* %7, i8** %3)
br label %9
9: ; preds = %28, %0
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %26
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 13
br i1 %18, label %24, label %19
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 32
br label %24
24: ; preds = %19, %14
%25 = phi i1 [ true, %14 ], [ %23, %19 ]
br label %26
26: ; preds = %24, %9
%27 = phi i1 [ false, %9 ], [ %25, %24 ]
br i1 %27, label %28, label %31
28: ; preds = %26
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %3
br label %9
31: ; preds = %26
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [11 x i8] c"foo { xx }\00"
define i32 @main() {
%1 = alloca [11 x i8]
%2 = alloca i8*
%3 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%4 = bitcast i8** %2 to i8*
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 5
store i8* %5, i8** %2
%6 = call i32 @foo(i8* %5, i8** %2)
%7 = load i8*, i8** %2
br label %8
8: ; preds = %11, %0
%9 = phi i8* [ %12, %11 ], [ %7, %0 ]
%10 = load i8, i8* %9
switch i8 %10, label %13 [
i8 32, label %11
i8 13, label %11
]
11: ; preds = %8, %8
%12 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %12, i8** %2
br label %8
13: ; preds = %8
ret i32 0
}