#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*/ execute_one_action(unsigned char *);
size_t strlen(unsigned char *);
void execute_all_actions(unsigned char *buf) {
  int i;
  unsigned char buf3[5000];
  buf3[0] = 0;
  for (i = 0; i < strlen(buf); i++) {
    if (buf[i] == '{') {
      execute_one_action(buf3);
      buf3[0] = 0;
    } else {
      buf3[strlen(buf3) + 1] = 0;
      buf3[strlen(buf3)] = buf[i];
    }
  }
  if (buf3[0] != 0)
    execute_one_action(buf3);
}


x86 assembly (clang, -O0):
<execute_all_actions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x13b0,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x13a0(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
mov    %rax,-0x13a8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x13a8(%rbp),%rax
cmp    %rcx,%rax
jae    11e2 <execute_all_actions+0xc2>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x7b,%eax
jne    1191 <execute_all_actions+0x71>
lea    -0x13a0(%rbp),%rdi
call   1040 <execute_one_action@plt>
movb   $0x0,-0x13a0(%rbp)
jmp    11cf <execute_all_actions+0xaf>
lea    -0x13a0(%rbp),%rdi
call   1030 <strlen@plt>
movb   $0x0,-0x139f(%rbp,%rax,1)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x13a9(%rbp)
lea    -0x13a0(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x13a9(%rbp),%cl
mov    %cl,-0x13a0(%rbp,%rax,1)
jmp    11d4 <execute_all_actions+0xb4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <execute_all_actions+0x1d>
movzbl -0x13a0(%rbp),%eax
cmp    $0x0,%eax
je     11fe <execute_all_actions+0xde>
lea    -0x13a0(%rbp),%rdi
call   1040 <execute_one_action@plt>
add    $0x13b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute_all_actions>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x1388,%rsp
movb   $0x0,(%rsp)
mov    (%rdi),%bpl
test   %bpl,%bpl
je     11ad <execute_all_actions+0x8d>
mov    %rdi,%r15
mov    $0x1,%ebx
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
cmp    $0x7b,%bpl
jne    1170 <execute_all_actions+0x50>
call   1040 <execute_one_action@plt>
movb   $0x0,(%rsp)
jmp    1187 <execute_all_actions+0x67>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <strlen@plt>
movb   $0x0,0x1(%rax,%r14,1)
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %bpl,(%rsp,%rax,1)
mov    %r15,%rdi
call   1030 <strlen@plt>
cmp    %rbx,%rax
jbe    119f <execute_all_actions+0x7f>
movzbl (%r15,%rbx,1),%ebp
add    $0x1,%rbx
jmp    1150 <execute_all_actions+0x30>
cmpb   $0x0,(%rsp)
je     11ad <execute_all_actions+0x8d>
mov    %rsp,%rdi
call   1040 <execute_one_action@plt>
add    $0x1388,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @execute_all_actions(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [5000 x i8]
store i8* %0, i8** %2
%5 = getelementptr inbounds [5000 x i8], [5000 x i8]* %4, i64 0, i64 0
store i8 0, i8* %5
store i32 0, i32* %3
br label %6
6: ; preds = %38, %1
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = load i8*, i8** %2
%10 = call i64 @strlen(i8* %9)
%11 = icmp ult i64 %8, %10
br i1 %11, label %12, label %41
12: ; preds = %6
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = icmp eq i32 %18, 123
br i1 %19, label %20, label %24
20: ; preds = %12
%21 = getelementptr inbounds [5000 x i8], [5000 x i8]* %4, i64 0, i64 0
%22 = call i32 @execute_one_action(i8* %21)
%23 = getelementptr inbounds [5000 x i8], [5000 x i8]* %4, i64 0, i64 0
store i8 0, i8* %23
br label %37
24: ; preds = %12
%25 = getelementptr inbounds [5000 x i8], [5000 x i8]* %4, i64 0, i64 0
%26 = call i64 @strlen(i8* %25)
%27 = add i64 %26, 1
%28 = getelementptr inbounds [5000 x i8], [5000 x i8]* %4, i64 0, i64 %27
store i8 0, i8* %28
%29 = load i8*, i8** %2
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = getelementptr inbounds [5000 x i8], [5000 x i8]* %4, i64 0, i64 0
%35 = call i64 @strlen(i8* %34)
%36 = getelementptr inbounds [5000 x i8], [5000 x i8]* %4, i64 0, i64 %35
store i8 %33, i8* %36
br label %37
37: ; preds = %24, %20
br label %38
38: ; preds = %37
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %6
41: ; preds = %6
%42 = getelementptr inbounds [5000 x i8], [5000 x i8]* %4, i64 0, i64 0
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %41
%47 = getelementptr inbounds [5000 x i8], [5000 x i8]* %4, i64 0, i64 0
%48 = call i32 @execute_one_action(i8* %47)
br label %49
49: ; preds = %46, %41
ret void
}

LLVM IR (-O2):
define void @execute_all_actions(i8* nocapture %0) {
%2 = alloca [5000 x i8]
%3 = getelementptr inbounds [5000 x i8], [5000 x i8]* %2, i64 0, i64 0
store i8 0, i8* %3
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %30, label %6
6: ; preds = %1, %22
%7 = phi i8 [ %24, %22 ], [ %4, %1 ]
%8 = phi i64 [ %19, %22 ], [ 0, %1 ]
%9 = icmp eq i8 %7, 123
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 @execute_one_action(i8* %3)
store i8 0, i8* %3
br label %18
12: ; preds = %6
%13 = call i64 @strlen(i8* %3)
%14 = add i64 %13, 1
%15 = getelementptr inbounds [5000 x i8], [5000 x i8]* %2, i64 0, i64 %14
store i8 0, i8* %15
%16 = call i64 @strlen(i8* %3)
%17 = getelementptr inbounds [5000 x i8], [5000 x i8]* %2, i64 0, i64 %16
store i8 %7, i8* %17
br label %18
18: ; preds = %10, %12
%19 = add nuw i64 %8, 1
%20 = call i64 @strlen(i8* dereferenceable(1) %0)
%21 = icmp ugt i64 %20, %19
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = getelementptr inbounds i8, i8* %0, i64 %19
%24 = load i8, i8* %23
br label %6
25: ; preds = %18
%26 = load i8, i8* %3
%27 = icmp eq i8 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = call i32 @execute_one_action(i8* %3)
br label %30
30: ; preds = %1, %28, %25
ret void
}