#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*/ go(int, int);
void new_corner() {
  static int corner;
  corner = (corner + 1) % 4;
  switch (corner) {
  case 0:
    go(10, 10);
    break;
  case 1:
    go(10, 990);
    break;
  case 2:
    go(990, 990);
    break;
  case 3:
    go(990, 10);
    break;
  }
}


x86 assembly (clang, -O0):
<new_corner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2f0e(%rip),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %edx,%ecx
add    $0x4,%ecx
test   %eax,%eax
cmovs  %ecx,%eax
and    $0xfffffffc,%eax
neg    %eax
mov    %eax,%ecx
mov    %edx,%eax
lea    0x1(%rax,%rcx,1),%eax
mov    %eax,0x2eec(%rip)
mov    0x2ee6(%rip),%eax
mov    %rax,-0x8(%rbp)
sub    $0x3,%rax
ja     11ad <new_corner+0x9d>
mov    -0x8(%rbp),%rax
lea    0xea1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0xa,%esi
mov    %esi,%edi
call   1030 <go@plt>
jmp    11ad <new_corner+0x9d>
mov    $0xa,%edi
mov    $0x3de,%esi
call   1030 <go@plt>
jmp    11ad <new_corner+0x9d>
mov    $0x3de,%esi
mov    %esi,%edi
call   1030 <go@plt>
jmp    11ad <new_corner+0x9d>
mov    $0x3de,%edi
mov    $0xa,%esi
call   1030 <go@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_corner>:
mov    0x2f16(%rip),%eax
lea    0x1(%rax),%ecx
lea    0x4(%rax),%edx
test   %ecx,%ecx
cmovns %ecx,%edx
and    $0xfffffffc,%edx
neg    %edx
add    %edx,%eax
add    $0x1,%eax
mov    %eax,0x2efb(%rip)
cmp    $0x3,%eax
ja     1155 <new_corner+0x45>
lea    0xec3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0xa,%edi
mov    $0xa,%esi
jmp    1030 <go@plt>
ret
mov    $0xa,%edi
mov    $0x3de,%esi
jmp    1030 <go@plt>
mov    $0x3de,%edi
mov    $0x3de,%esi
jmp    1030 <go@plt>
mov    $0x3de,%edi
mov    $0xa,%esi
jmp    1030 <go@plt>

LLVM IR (-O0):
@new_corner.corner = internal global i32 0
define void @new_corner() {
%1 = load i32, i32* @new_corner.corner
%2 = add nsw i32 %1, 1
%3 = srem i32 %2, 4
store i32 %3, i32* @new_corner.corner
%4 = load i32, i32* @new_corner.corner
switch i32 %4, label %13 [
i32 0, label %5
i32 1, label %7
i32 2, label %9
i32 3, label %11
]
5: ; preds = %0
%6 = call i32 @go(i32 10, i32 10)
br label %13
7: ; preds = %0
%8 = call i32 @go(i32 10, i32 990)
br label %13
9: ; preds = %0
%10 = call i32 @go(i32 990, i32 990)
br label %13
11: ; preds = %0
%12 = call i32 @go(i32 990, i32 10)
br label %13
13: ; preds = %0, %11, %9, %7, %5
ret void
}

LLVM IR (-O2):
@new_corner.corner = internal unnamed_addr global i32 0
define void @new_corner() {
%1 = load i32, i32* @new_corner.corner
%2 = add nsw i32 %1, 1
%3 = srem i32 %2, 4
store i32 %3, i32* @new_corner.corner
switch i32 %3, label %12 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
]
4: ; preds = %0
%5 = tail call i32 @go(i32 10, i32 10)
br label %12
6: ; preds = %0
%7 = tail call i32 @go(i32 10, i32 990)
br label %12
8: ; preds = %0
%9 = tail call i32 @go(i32 990, i32 990)
br label %12
10: ; preds = %0
%11 = tail call i32 @go(i32 990, i32 10)
br label %12
12: ; preds = %0, %10, %8, %6, %4
ret void
}