#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*/ do_substitutions(char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ generate_jumps(char *);
scalar_t__ isspace(char);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ stdin;
void generate(void) {
  char buf[512];
  while (fgets(buf, 512, stdin) != NULL) {
    if (memcmp(buf, "%jump", 5) == 0 && isspace(buf[5])) {
      generate_jumps(buf + 6);
    } else
      do_substitutions(buf);
  }
}


x86 assembly (clang, -O0):
<generate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200,%rsp
lea    -0x200(%rbp),%rdi
mov    0x2e7f(%rip),%rax
mov    (%rax),%edx
mov    $0x200,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11dd <generate+0x8d>
lea    -0x200(%rbp),%rdi
lea    0xe73(%rip),%rsi
mov    $0x5,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
jne    11cc <generate+0x7c>
movsbl -0x1fb(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     11cc <generate+0x7c>
lea    -0x200(%rbp),%rdi
add    $0x6,%rdi
call   1060 <generate_jumps@plt>
jmp    11d8 <generate+0x88>
lea    -0x200(%rbp),%rdi
call   1070 <do_substitutions@plt>
jmp    115b <generate+0xb>
add    $0x200,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x208,%rsp
mov    0x2e83(%rip),%r12
mov    (%r12),%edx
mov    %rsp,%rdi
mov    $0x200,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11dc <generate+0x8c>
lea    0x6(%rsp),%r14
lea    0xe79(%rip),%r15
mov    %rsp,%rbx
jmp    11ae <generate+0x5e>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1070 <do_substitutions@plt>
mov    (%r12),%edx
mov    %rbx,%rdi
mov    $0x200,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11dc <generate+0x8c>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x5,%edx
call   1040 <memcmp@plt>
test   %rax,%rax
jne    1190 <generate+0x40>
movsbl 0x5(%rsp),%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     1190 <generate+0x40>
mov    %r14,%rdi
call   1060 <generate_jumps@plt>
jmp    1198 <generate+0x48>
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [6 x i8] c"%jump\00"
define void @generate() {
%1 = alloca [512 x i8]
br label %2
2: ; preds = %23, %0
%3 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i32* @fgets(i8* %3, i32 512, i32 %4)
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %24
7: ; preds = %2
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%9 = call i64 @memcmp(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 5
%13 = load i8, i8* %12
%14 = call i64 @isspace(i8 signext %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%18 = getelementptr inbounds i8, i8* %17, i64 6
%19 = call i32 @generate_jumps(i8* %18)
br label %23
20: ; preds = %11, %7
%21 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%22 = call i32 @do_substitutions(i8* %21)
br label %23
23: ; preds = %20, %16
br label %2
24: ; preds = %2
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [6 x i8] c"%jump\00"
define void @generate() {
%1 = alloca [512 x i8]
%2 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32* @fgets(i8* %2, i32 512, i32 %3)
%5 = icmp eq i32* %4, null
br i1 %5, label %24, label %6
6: ; preds = %0
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 5
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 6
br label %9
9: ; preds = %6, %20
%10 = call i64 @memcmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load i8, i8* %7
%14 = call i64 @isspace(i8 signext %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = call i32 @generate_jumps(i8* %8)
br label %20
18: ; preds = %12, %9
%19 = call i32 @do_substitutions(i8* %2)
br label %20
20: ; preds = %18, %16
%21 = load i32, i32* @stdin
%22 = call i32* @fgets(i8* %2, i32 512, i32 %21)
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %9
24: ; preds = %20, %0
ret void
}