#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*/ static_assert(int);
scalar_t__ unknown();
void main(int n) {
  int x, m;
  x = 0;
  m = 0;
  while (x < n) {
    if (unknown())
      m = x;
    x++;
  }
  if (n > 0) {
    static_assert(0 <= m && m < n);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    116a <main+0x4a>
mov    $0x0,%al
call   1030 <unknown@plt>
cmp    $0x0,%rax
je     115c <main+0x3c>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <main+0x19>
cmpl   $0x0,-0x4(%rbp)
jle    119d <main+0x7d>
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0xc(%rbp),%ecx
mov    %al,-0xd(%rbp)
jg     1190 <main+0x70>
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
setl   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <static_assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    1163 <main+0x43>
mov    %edi,%r14d
xor    %ebp,%ebp
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1030 <unknown@plt>
test   %rax,%rax
cmovne %ebx,%ebp
add    $0x1,%ebx
cmp    %ebx,%r14d
jne    1130 <main+0x10>
test   %r14d,%r14d
jle    1163 <main+0x43>
test   %ebp,%ebp
setns  %al
cmp    %r14d,%ebp
setl   %cl
and    %al,%cl
movzbl %cl,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <static_assert@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @main(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %14, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %17
9: ; preds = %5
%10 = call i64 (...) @unknown()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = load i32, i32* %3
store i32 %13, i32* %4
br label %14
14: ; preds = %12, %9
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %5
17: ; preds = %5
%18 = load i32, i32* %2
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %31
20: ; preds = %17
%21 = load i32, i32* %4
%22 = icmp sle i32 0, %21
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load i32, i32* %4
%25 = load i32, i32* %2
%26 = icmp slt i32 %24, %25
br label %27
27: ; preds = %23, %20
%28 = phi i1 [ false, %20 ], [ %26, %23 ]
%29 = zext i1 %28 to i32
%30 = call i32 @static_assert(i32 %29)
br label %31
31: ; preds = %27, %17
ret void
}

LLVM IR (-O2):
define void @main(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %18
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = tail call i64 (...) @unknown()
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i32 %4, i32 %5
%9 = add nuw nsw i32 %5, 1
%10 = icmp eq i32 %9, %0
br i1 %10, label %11, label %3
11: ; preds = %3
br i1 %2, label %12, label %18
12: ; preds = %11
%13 = icmp sgt i32 %8, -1
%14 = icmp slt i32 %8, %0
%15 = and i1 %13, %14
%16 = zext i1 %15 to i32
%17 = tail call i32 @static_assert(i32 %16)
br label %18
18: ; preds = %1, %12, %11
ret void
}