#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);
void bar(void) {
  int a = 2;
  int b = 5;
  char c[] = {
      2, 4, 1, 2, 5, 5, 2, 4, 4, 0, 0, 0, 0, 0, 0, 3, 4, 4, 2, 4, 1, 2, 5, 5, 2,
      4, 1, 0, 0, 0, 2, 4, 4, 3, 4, 3, 3, 5, 1, 3, 5, 5, 2, 4, 4, 2, 4, 1, 3, 5,
      3, 3, 5, 1, 3, 5, 1, 2, 4, 4, 2, 4, 2, 3, 5, 1, 3, 5, 1, 3, 5, 5, 2, 4, 1,
      2, 4, 2, 3, 5, 3, 3, 5, 1, 3, 5, 5, 2, 4, 1, 2, 4, 1, 3, 5, 3, 3, 5, 1, 3,
      5, 5, 2, 4, 4, 2, 4, 1, 3, 5, 3, 3, 5, 1, 3, 5, 1, 2, 4, 1, 2, 4, 2, 3, 5,
      1, 3, 5, 1, 3, 5, 1, 2, 4, 1, 2, 4, 1, 3, 5, 1, 3, 5, 1, 3, 5, 1, 2, 4, 4,
      2, 4, 1, 3, 5, 1, 3, 5, 1, 3, 5, 5, 2, 4, 4, 2, 4, 2, 3, 5, 3, 3, 5, 1, 3,
      5, 5, 2, 4, 4, 2, 4, 1, 3, 5, 3, 3, 5, 1, 3, 5, 1, 2, 5, 5, 2, 4, 2, 3, 5,
      1, 3, 4, 1, 3, 5, 1, 2, 5, 5, 2, 4, 1, 2, 5, 1, 3, 5, 3, 3, 5, 1, 2, 5, 5,
      2, 4, 2, 2, 5, 1, 3, 5, 3, 3, 5, 1, 2, 5, 1, 2, 4, 1, 2, 5, 2, 3, 5, 1, 3,
      5, 1, 2, 5, 1, 2, 4, 2, 2, 5, 1, 3, 5, 1, 3, 5, 1, 2, 5, 5, 2, 4, 2, 2, 5,
      2, 3, 5, 3, 3, 5, 1, 2, 5, 5, 2, 4, 2, 2, 5, 2, 3, 5, 3, 3, 5, 1, 2, 5, 5,
      2, 4, 2, 2, 5, 1, 3, 5, 3, 3, 5, 1, 2, 5, 5, 2, 4, 2, 2, 5, 1, 3, 5, 3, 3,
      5, 1, 2, 5, 1, 2, 4, 1, 2, 5, 2, 3, 5, 1, 3, 5, 1, 2, 5, 5, 2, 4, 2, 2, 5,
      2, 3, 5, 3, 3, 5, 1, 2, 5, 5, 2, 4, 1, 2, 5, 1, 3, 5, 3, 3, 5, 1, 2, 5, 5,
      2, 4, 2, 2, 5, 1, 3, 5, 3, 3, 5, 1, 2, 5, 5, 2, 4, 2, 2, 5, 1, 3, 5, 3, 3,
      5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  char *f = c + 390;
  int i, j, e, g, h;
  char k, l;
  i = 26;
  j = 25;
  k = l = 'M';
  h = 2;
  while (i > 0) {
    int x = i - a;
    x = x > 0 ? x : 0;
    x = j - x;
    g = x * 3 + h;
    switch (f[g]) {
    case 1:
      --i;
      --j;
      h = 2;
      f -= b * 3;
      k = 'M';
      break;
    case 2:
      --i;
      h = 0;
      f -= b * 3;
      k = 'I';
      break;
    case 3:
      --i;
      h = 2;
      f -= b * 3;
      k = 'I';
      break;
    case 4:
      --j;
      h = 1;
      k = 'D';
      break;
    case 5:
      --j;
      h = 2;
      k = 'D';
      break;
    }
    if (k == l)
      ++e;
    else {
      foo(l);
      l = k;
    }
  }
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1e0,%rsp
movl   $0x2,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
lea    -0x1b0(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x1a4,%edx
call   1030 <memcpy@plt>
lea    -0x1b0(%rbp),%rax
add    $0x186,%rax
mov    %rax,-0x1b8(%rbp)
movl   $0x1a,-0x1bc(%rbp)
movl   $0x19,-0x1c0(%rbp)
movb   $0x4d,-0x1ce(%rbp)
movb   $0x4d,-0x1cd(%rbp)
movl   $0x2,-0x1cc(%rbp)
cmpl   $0x0,-0x1bc(%rbp)
jle    13b0 <bar+0x290>
mov    -0x1bc(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x1d4(%rbp)
cmpl   $0x0,-0x1d4(%rbp)
jle    11cb <bar+0xab>
mov    -0x1d4(%rbp),%eax
mov    %eax,-0x1d8(%rbp)
jmp    11d8 <bar+0xb8>
xor    %eax,%eax
mov    %eax,-0x1d8(%rbp)
jmp    11d8 <bar+0xb8>
mov    -0x1d8(%rbp),%eax
mov    %eax,-0x1d4(%rbp)
mov    -0x1c0(%rbp),%eax
mov    -0x1d4(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x1d4(%rbp)
mov    -0x1d4(%rbp),%ecx
mov    %ecx,%eax
lea    (%rax,%rax,2),%eax
mov    -0x1cc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x1c8(%rbp)
mov    -0x1b8(%rbp),%rax
movslq -0x1c8(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x1e0(%rbp)
sub    $0x4,%eax
ja     1369 <bar+0x249>
mov    -0x1e0(%rbp),%rax
lea    0xdba(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x1bc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1bc(%rbp)
mov    -0x1c0(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c0(%rbp)
movl   $0x2,-0x1cc(%rbp)
imul   $0x3,-0x8(%rbp),%ecx
mov    -0x1b8(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x1b8(%rbp)
movb   $0x4d,-0x1cd(%rbp)
jmp    1369 <bar+0x249>
mov    -0x1bc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1bc(%rbp)
movl   $0x0,-0x1cc(%rbp)
imul   $0x3,-0x8(%rbp),%ecx
mov    -0x1b8(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x1b8(%rbp)
movb   $0x49,-0x1cd(%rbp)
jmp    1369 <bar+0x249>
mov    -0x1bc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1bc(%rbp)
movl   $0x2,-0x1cc(%rbp)
imul   $0x3,-0x8(%rbp),%ecx
mov    -0x1b8(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x1b8(%rbp)
movb   $0x49,-0x1cd(%rbp)
jmp    1369 <bar+0x249>
mov    -0x1c0(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c0(%rbp)
movl   $0x1,-0x1cc(%rbp)
movb   $0x44,-0x1cd(%rbp)
jmp    1369 <bar+0x249>
mov    -0x1c0(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c0(%rbp)
movl   $0x2,-0x1cc(%rbp)
movb   $0x44,-0x1cd(%rbp)
movsbl -0x1cd(%rbp),%eax
movsbl -0x1ce(%rbp),%ecx
cmp    %ecx,%eax
jne    1393 <bar+0x273>
mov    -0x1c4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c4(%rbp)
jmp    13ab <bar+0x28b>
movsbl -0x1ce(%rbp),%edi
call   1040 <foo@plt>
mov    -0x1cd(%rbp),%al
mov    %al,-0x1ce(%rbp)
jmp    1191 <bar+0x71>
add    $0x1e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a8,%rsp
lea    0xee8(%rip),%rsi
mov    %rsp,%rdi
mov    $0x1a4,%edx
call   1030 <memcpy@plt>
mov    $0x19,%r14d
mov    $0x1a,%ebp
mov    $0x2,%r13d
mov    $0x4d,%al
lea    0x186(%rsp),%r12
lea    0xe99(%rip),%r15
mov    $0x4d,%bl
jmp    1178 <bar+0x58>
nopl   0x0(%rax,%rax,1)
test   %ebp,%ebp
jle    11ff <bar+0xdf>
cmp    $0x3,%ebp
mov    $0x2,%ecx
cmovae %ebp,%ecx
mov    %r14d,%edx
sub    %ecx,%edx
lea    (%rdx,%rdx,2),%ecx
add    %r13d,%ecx
add    $0x6,%ecx
movslq %ecx,%rcx
movsbl (%r12,%rcx,1),%ecx
add    $0xffffffff,%ecx
cmp    $0x4,%ecx
ja     11ec <bar+0xcc>
movslq (%r15,%rcx,4),%rcx
add    %r15,%rcx
jmp    *%rcx
add    $0xffffffff,%ebp
add    $0xffffffff,%r14d
add    $0xfffffffffffffff1,%r12
mov    $0x4d,%bl
jmp    11e6 <bar+0xc6>
add    $0xffffffff,%ebp
add    $0xfffffffffffffff1,%r12
mov    $0x49,%bl
xor    %r13d,%r13d
jmp    11ec <bar+0xcc>
add    $0xffffffff,%ebp
add    $0xfffffffffffffff1,%r12
mov    $0x49,%bl
jmp    11e6 <bar+0xc6>
add    $0xffffffff,%r14d
mov    $0x44,%bl
mov    $0x1,%r13d
jmp    11ec <bar+0xcc>
add    $0xffffffff,%r14d
mov    $0x44,%bl
mov    $0x2,%r13d
cmp    %al,%bl
je     1170 <bar+0x50>
movsbl %al,%edi
call   1040 <foo@plt>
mov    %ebx,%eax
jmp    1170 <bar+0x50>
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.bar.c = <{ [402 x i8], [18 x i8] }> <{ [402 x i8] c"\02\04\01\02\05\05\02\04\04\00\00\00\00\00\00\03\04\04\02\04\01\02\05\05\02\04\01\00\00\00\02\04\04\03\04\03\03\05\01\03\05\05\02\04\04\02\04\01\03\05\03\03\05\01\03\05\01\02\04\04\02\04\02\03\05\01\03\05\01\03\05\05\02\04\01\02\04\02\03\05\03\03\05\01\03\05\05\02\04\01\02\04\01\03\05\03\03\05\01\03\05\05\02\04\04\02\04\01\03\05\03\03\05\01\03\05\01\02\04\01\02\04\02\03\05\01\03\05\01\03\05\01\02\04\01\02\04\01\03\05\01\03\05\01\03\05\01\02\04\04\02\04\01\03\05\01\03\05\01\03\05\05\02\04\04\02\04\02\03\05\03\03\05\01\03\05\05\02\04\04\02\04\01\03\05\03\03\05\01\03\05\01\02\05\05\02\04\02\03\05\01\03\04\01\03\05\01\02\05\05\02\04\01\02\05\01\03\05\03\03\05\01\02\05\05\02\04\02\02\05\01\03\05\03\03\05\01\02\05\01\02\04\01\02\05\02\03\05\01\03\05\01\02\05\01\02\04\02\02\05\01\03\05\01\03\05\01\02\05\05\02\04\02\02\05\02\03\05\03\03\05\01\02\05\05\02\04\02\02\05\02\03\05\03\03\05\01\02\05\05\02\04\02\02\05\01\03\05\03\03\05\01\02\05\05\02\04\02\02\05\01\03\05\03\03\05\01\02\05\01\02\04\01\02\05\02\03\05\01\03\05\01\02\05\05\02\04\02\02\05\02\03\05\03\03\05\01\02\05\05\02\04\01\02\05\01\03\05\03\03\05\01\02\05\05\02\04\02\02\05\01\03\05\03\03\05\01\02\05\05\02\04\02\02\05\01\03\05\03\03\05\01", [18 x i8] zeroinitializer }>
define void @bar() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [420 x i8]
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca i8
%12 = alloca i32
store i32 2, i32* %1
store i32 5, i32* %2
%13 = bitcast [420 x i8]* %3 to i8*
%14 = getelementptr inbounds [420 x i8], [420 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds i8, i8* %14, i64 390
store i8* %15, i8** %4
store i32 26, i32* %5
store i32 25, i32* %6
store i8 77, i8* %11
store i8 77, i8* %10
store i32 2, i32* %9
br label %16
16: ; preds = %91, %0
%17 = load i32, i32* %5
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %92
19: ; preds = %16
%20 = load i32, i32* %5
%21 = load i32, i32* %1
%22 = sub nsw i32 %20, %21
store i32 %22, i32* %12
%23 = load i32, i32* %12
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = load i32, i32* %12
br label %28
27: ; preds = %19
br label %28
28: ; preds = %27, %25
%29 = phi i32 [ %26, %25 ], [ 0, %27 ]
store i32 %29, i32* %12
%30 = load i32, i32* %6
%31 = load i32, i32* %12
%32 = sub nsw i32 %30, %31
store i32 %32, i32* %12
%33 = load i32, i32* %12
%34 = mul nsw i32 %33, 3
%35 = load i32, i32* %9
%36 = add nsw i32 %34, %35
store i32 %36, i32* %8
%37 = load i8*, i8** %4
%38 = load i32, i32* %8
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
switch i32 %42, label %78 [
i32 1, label %43
i32 2, label %54
i32 3, label %63
i32 4, label %72
i32 5, label %75
]
43: ; preds = %28
%44 = load i32, i32* %5
%45 = add nsw i32 %44, -1
store i32 %45, i32* %5
%46 = load i32, i32* %6
%47 = add nsw i32 %46, -1
store i32 %47, i32* %6
store i32 2, i32* %9
%48 = load i32, i32* %2
%49 = mul nsw i32 %48, 3
%50 = load i8*, i8** %4
%51 = sext i32 %49 to i64
%52 = sub i64 0, %51
%53 = getelementptr inbounds i8, i8* %50, i64 %52
store i8* %53, i8** %4
store i8 77, i8* %10
br label %78
54: ; preds = %28
%55 = load i32, i32* %5
%56 = add nsw i32 %55, -1
store i32 %56, i32* %5
store i32 0, i32* %9
%57 = load i32, i32* %2
%58 = mul nsw i32 %57, 3
%59 = load i8*, i8** %4
%60 = sext i32 %58 to i64
%61 = sub i64 0, %60
%62 = getelementptr inbounds i8, i8* %59, i64 %61
store i8* %62, i8** %4
store i8 73, i8* %10
br label %78
63: ; preds = %28
%64 = load i32, i32* %5
%65 = add nsw i32 %64, -1
store i32 %65, i32* %5
store i32 2, i32* %9
%66 = load i32, i32* %2
%67 = mul nsw i32 %66, 3
%68 = load i8*, i8** %4
%69 = sext i32 %67 to i64
%70 = sub i64 0, %69
%71 = getelementptr inbounds i8, i8* %68, i64 %70
store i8* %71, i8** %4
store i8 73, i8* %10
br label %78
72: ; preds = %28
%73 = load i32, i32* %6
%74 = add nsw i32 %73, -1
store i32 %74, i32* %6
store i32 1, i32* %9
store i8 68, i8* %10
br label %78
75: ; preds = %28
%76 = load i32, i32* %6
%77 = add nsw i32 %76, -1
store i32 %77, i32* %6
store i32 2, i32* %9
store i8 68, i8* %10
br label %78
78: ; preds = %28, %75, %72, %63, %54, %43
%79 = load i8, i8* %10
%80 = sext i8 %79 to i32
%81 = load i8, i8* %11
%82 = sext i8 %81 to i32
%83 = icmp eq i32 %80, %82
br i1 %83, label %84, label %87
84: ; preds = %78
%85 = load i32, i32* %7
%86 = add nsw i32 %85, 1
store i32 %86, i32* %7
br label %91
87: ; preds = %78
%88 = load i8, i8* %11
%89 = call i32 @foo(i8 signext %88)
%90 = load i8, i8* %10
store i8 %90, i8* %11
br label %91
91: ; preds = %87, %84
br label %16
92: ; preds = %16
ret void
}

LLVM IR (-O2):
@__const.bar.c = <{ [402 x i8], [18 x i8] }> <{ [402 x i8] c"\02\04\01\02\05\05\02\04\04\00\00\00\00\00\00\03\04\04\02\04\01\02\05\05\02\04\01\00\00\00\02\04\04\03\04\03\03\05\01\03\05\05\02\04\04\02\04\01\03\05\03\03\05\01\03\05\01\02\04\04\02\04\02\03\05\01\03\05\01\03\05\05\02\04\01\02\04\02\03\05\03\03\05\01\03\05\05\02\04\01\02\04\01\03\05\03\03\05\01\03\05\05\02\04\04\02\04\01\03\05\03\03\05\01\03\05\01\02\04\01\02\04\02\03\05\01\03\05\01\03\05\01\02\04\01\02\04\01\03\05\01\03\05\01\03\05\01\02\04\04\02\04\01\03\05\01\03\05\01\03\05\05\02\04\04\02\04\02\03\05\03\03\05\01\03\05\05\02\04\04\02\04\01\03\05\03\03\05\01\03\05\01\02\05\05\02\04\02\03\05\01\03\04\01\03\05\01\02\05\05\02\04\01\02\05\01\03\05\03\03\05\01\02\05\05\02\04\02\02\05\01\03\05\03\03\05\01\02\05\01\02\04\01\02\05\02\03\05\01\03\05\01\02\05\01\02\04\02\02\05\01\03\05\01\03\05\01\02\05\05\02\04\02\02\05\02\03\05\03\03\05\01\02\05\05\02\04\02\02\05\02\03\05\03\03\05\01\02\05\05\02\04\02\02\05\01\03\05\03\03\05\01\02\05\05\02\04\02\02\05\01\03\05\03\03\05\01\02\05\01\02\04\01\02\05\02\03\05\01\03\05\01\02\05\05\02\04\02\02\05\02\03\05\03\03\05\01\02\05\05\02\04\01\02\05\01\03\05\03\03\05\01\02\05\05\02\04\02\02\05\01\03\05\03\03\05\01\02\05\05\02\04\02\02\05\01\03\05\03\03\05\01", [18 x i8] zeroinitializer }>
define void @bar() {
%1 = alloca [420 x i8]
%2 = getelementptr inbounds [420 x i8], [420 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [420 x i8], [420 x i8]* %1, i64 0, i64 390
br label %4
4: ; preds = %0, %44
%5 = phi i8* [ %3, %0 ], [ %40, %44 ]
%6 = phi i8 [ 77, %0 ], [ %45, %44 ]
%7 = phi i8 [ 77, %0 ], [ %39, %44 ]
%8 = phi i32 [ 2, %0 ], [ %38, %44 ]
%9 = phi i32 [ 26, %0 ], [ %37, %44 ]
%10 = phi i32 [ 25, %0 ], [ %36, %44 ]
%11 = icmp ugt i32 %9, 2
%12 = select i1 %11, i32 %9, i32 2
%13 = add i32 %10, 2
%14 = sub i32 %13, %12
%15 = mul nsw i32 %14, 3
%16 = add nsw i32 %15, %8
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %5, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
switch i32 %20, label %35 [
i32 1, label %21
i32 2, label %25
i32 3, label %28
i32 4, label %31
i32 5, label %33
]
21: ; preds = %4
%22 = add nsw i32 %9, -1
%23 = add nsw i32 %10, -1
%24 = getelementptr inbounds i8, i8* %5, i64 -15
br label %35
25: ; preds = %4
%26 = add nsw i32 %9, -1
%27 = getelementptr inbounds i8, i8* %5, i64 -15
br label %35
28: ; preds = %4
%29 = add nsw i32 %9, -1
%30 = getelementptr inbounds i8, i8* %5, i64 -15
br label %35
31: ; preds = %4
%32 = add nsw i32 %10, -1
br label %35
33: ; preds = %4
%34 = add nsw i32 %10, -1
br label %35
35: ; preds = %4, %33, %31, %28, %25, %21
%36 = phi i32 [ %10, %4 ], [ %34, %33 ], [ %32, %31 ], [ %10, %28 ], [ %10, %25 ], [ %23, %21 ]
%37 = phi i32 [ %9, %4 ], [ %9, %33 ], [ %9, %31 ], [ %29, %28 ], [ %26, %25 ], [ %22, %21 ]
%38 = phi i32 [ %8, %4 ], [ 2, %33 ], [ 1, %31 ], [ 2, %28 ], [ 0, %25 ], [ 2, %21 ]
%39 = phi i8 [ %7, %4 ], [ 68, %33 ], [ 68, %31 ], [ 73, %28 ], [ 73, %25 ], [ 77, %21 ]
%40 = phi i8* [ %5, %4 ], [ %5, %33 ], [ %5, %31 ], [ %30, %28 ], [ %27, %25 ], [ %24, %21 ]
%41 = icmp eq i8 %39, %6
br i1 %41, label %44, label %42
42: ; preds = %35
%43 = tail call i32 @foo(i8 signext %6)
br label %44
44: ; preds = %35, %42
%45 = phi i8 [ %39, %42 ], [ %6, %35 ]
%46 = icmp sgt i32 %37, 0
br i1 %46, label %4, label %47
47: ; preds = %44
ret void
}