#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 misra_5_2_func1();
int /*<<< orphan*/ misra_5_2_func2();
int /*<<< orphan*/ misra_5_2_func3();
void foo(void) {
  int i;
  switch (misra_5_2_func1()) {
  case 1: {
    do {
      for (i = 0; i < 10; i++) {
        if (misra_5_2_func3()) {
          int misra_5_2_var_hides_var_1____31x;
          int misra_5_2_var_hides_var_1____31y;
        }
      }
    } while (misra_5_2_func2());
  }
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <misra_5_2_func1@plt>
sub    $0x1,%eax
jne    11a5 <foo+0x75>
jmp    114d <foo+0x1d>
jmp    1152 <foo+0x22>
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    118b <foo+0x5b>
mov    $0x0,%al
call   1050 <misra_5_2_func3@plt>
cmp    $0x0,%eax
je     1178 <foo+0x48>
jmp    1178 <foo+0x48>
jmp    117d <foo+0x4d>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <foo+0x29>
jmp    1190 <foo+0x60>
mov    $0x0,%al
call   1030 <misra_5_2_func2@plt>
cmp    $0x0,%eax
jne    1152 <foo+0x22>
jmp    11a5 <foo+0x75>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %eax,%eax
call   1040 <misra_5_2_func1@plt>
cmp    $0x1,%eax
jne    1191 <foo+0x61>
nopl   (%rax)
xor    %eax,%eax
call   1050 <misra_5_2_func3@plt>
xor    %eax,%eax
call   1050 <misra_5_2_func3@plt>
xor    %eax,%eax
call   1050 <misra_5_2_func3@plt>
xor    %eax,%eax
call   1050 <misra_5_2_func3@plt>
xor    %eax,%eax
call   1050 <misra_5_2_func3@plt>
xor    %eax,%eax
call   1050 <misra_5_2_func3@plt>
xor    %eax,%eax
call   1050 <misra_5_2_func3@plt>
xor    %eax,%eax
call   1050 <misra_5_2_func3@plt>
xor    %eax,%eax
call   1050 <misra_5_2_func3@plt>
xor    %eax,%eax
call   1050 <misra_5_2_func3@plt>
xor    %eax,%eax
call   1030 <misra_5_2_func2@plt>
test   %eax,%eax
jne    1140 <foo+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @foo() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @misra_5_2_func1()
switch i32 %4, label %23 [
i32 1, label %5
]
5: ; preds = %0
br label %6
6: ; preds = %19, %5
store i32 0, i32* %1
br label %7
7: ; preds = %15, %6
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = call i32 (...) @misra_5_2_func3()
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
br label %14
14: ; preds = %13, %10
br label %15
15: ; preds = %14
%16 = load i32, i32* %1
%17 = add nsw i32 %16, 1
store i32 %17, i32* %1
br label %7
18: ; preds = %7
br label %19
19: ; preds = %18
%20 = call i32 (...) @misra_5_2_func2()
%21 = icmp ne i32 %20, 0
br i1 %21, label %6, label %22
22: ; preds = %19
br label %23
23: ; preds = %22, %0
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 (...) @misra_5_2_func1()
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %16
3: ; preds = %0, %3
%4 = tail call i32 (...) @misra_5_2_func3()
%5 = tail call i32 (...) @misra_5_2_func3()
%6 = tail call i32 (...) @misra_5_2_func3()
%7 = tail call i32 (...) @misra_5_2_func3()
%8 = tail call i32 (...) @misra_5_2_func3()
%9 = tail call i32 (...) @misra_5_2_func3()
%10 = tail call i32 (...) @misra_5_2_func3()
%11 = tail call i32 (...) @misra_5_2_func3()
%12 = tail call i32 (...) @misra_5_2_func3()
%13 = tail call i32 (...) @misra_5_2_func3()
%14 = tail call i32 (...) @misra_5_2_func2()
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %3
16: ; preds = %3, %0
ret void
}