#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ do_lmn_fatal(char *, int, char *);
unsigned long round2up(unsigned long n) {
  unsigned int v = 1;
  while (v && v < n) {
    v <<= 1;
  }
  if (v == 0) {
    do {
      do_lmn_fatal(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/ysm001/slim/refs/heads/master/src/util.h",
          153, "too large size");
      assert((0));
    } while (0);
    ;
  }
  return v;
}


x86 assembly (clang, -O0):
<round2up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
je     114f <round2up+0x2f>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%rax
setb   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    115f <round2up+0x3f>
jmp    116d <round2up+0x4d>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <round2up+0x13>
cmpl   $0x0,-0xc(%rbp)
jne    11a0 <round2up+0x80>
jmp    117c <round2up+0x5c>
lea    0xe7d(%rip),%rdi
mov    $0x99,%esi
lea    0xef4(%rip),%rdx
call   1040 <do_lmn_fatal@plt>
xor    %edi,%edi
call   1030 <assert@plt>
jmp    11a0 <round2up+0x80>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round2up>:
push   %rbx
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %ecx,%eax
mov    %ecx,%ebx
test   %ecx,%ecx
je     1140 <round2up+0x20>
lea    (%rax,%rax,1),%ecx
cmp    %rdi,%rbx
jb     1130 <round2up+0x10>
test   %eax,%eax
jne    1163 <round2up+0x43>
lea    0xeb5(%rip),%rdi
lea    0xf31(%rip),%rdx
mov    $0x99,%esi
call   1040 <do_lmn_fatal@plt>
xor    %edi,%edi
call   1030 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [131 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ysm001/slim/refs/heads/master/src/util.h\00"
@.str.1 = [15 x i8] c"too large size\00"
define i64 @round2up(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
store i32 1, i32* %3
br label %4
4: ; preds = %14, %1
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %3
%9 = zext i32 %8 to i64
%10 = load i64, i64* %2
%11 = icmp ult i64 %9, %10
br label %12
12: ; preds = %7, %4
%13 = phi i1 [ false, %4 ], [ %11, %7 ]
br i1 %13, label %14, label %17
14: ; preds = %12
%15 = load i32, i32* %3
%16 = shl i32 %15, 1
store i32 %16, i32* %3
br label %4
17: ; preds = %12
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %17
br label %21
21: ; preds = %20
%22 = call i32 @do_lmn_fatal(i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str, i64 0, i64 0), i32 153, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @assert(i32 0)
br label %24
24: ; preds = %21
br label %25
25: ; preds = %24, %17
%26 = load i32, i32* %3
%27 = zext i32 %26 to i64
ret i64 %27
}

LLVM IR (-O2):
@.str = [131 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ysm001/slim/refs/heads/master/src/util.h\00"
@.str.1 = [15 x i8] c"too large size\00"
define i64 @round2up(i64 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %8, %2 ]
%4 = icmp ne i32 %3, 0
%5 = zext i32 %3 to i64
%6 = icmp ult i64 %5, %0
%7 = and i1 %4, %6
%8 = shl i32 %3, 1
br i1 %7, label %2, label %9
9: ; preds = %2
%10 = icmp eq i32 %3, 0
br i1 %10, label %11, label %14
11: ; preds = %9
%12 = tail call i32 @do_lmn_fatal(i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str, i64 0, i64 0), i32 153, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @assert(i32 0)
br label %14
14: ; preds = %11, %9
%15 = zext i32 %3 to i64
ret i64 %15
}