#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 EOF;
int fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
unsigned int ue7_32() {
  int i;
  unsigned int buffer = 0;
  for (i = 0; i < 5; ++i) {
    int c = fgetc(stdin);
    if (c == EOF)
      return buffer;
    buffer = (buffer << 7) | (c & 0x7F);
    if ((c & 0x80) == 0) {
      return buffer;
    }
  }
  return buffer;
}


x86 assembly (clang, -O0):
<ue7_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    119e <ue7_32+0x8e>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    0x2e95(%rip),%rcx
cmp    (%rcx),%eax
jne    115e <ue7_32+0x4e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a4 <ue7_32+0x94>
mov    -0xc(%rbp),%eax
shl    $0x7,%eax
mov    -0x10(%rbp),%ecx
and    $0x7f,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    118b <ue7_32+0x7b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a4 <ue7_32+0x94>
jmp    1190 <ue7_32+0x80>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <ue7_32+0x16>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ue7_32>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2eca(%rip),%r14
mov    (%r14),%edi
call   1030 <fgetc@plt>
mov    0x2eb3(%rip),%r15
xor    %ebx,%ebx
cmp    (%r15),%eax
je     114c <ue7_32+0x3c>
mov    %eax,%ebp
and    $0x7f,%ebp
test   $0x80,%al
je     114a <ue7_32+0x3a>
mov    (%r14),%edi
call   1030 <fgetc@plt>
cmp    (%r15),%eax
jne    1159 <ue7_32+0x49>
mov    %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
shl    $0x7,%ebp
mov    %eax,%ebx
and    $0x7f,%ebx
or     %ebp,%ebx
test   $0x80,%al
je     114c <ue7_32+0x3c>
mov    (%r14),%edi
call   1030 <fgetc@plt>
cmp    (%r15),%eax
je     114c <ue7_32+0x3c>
mov    %ebx,%ecx
shl    $0x7,%ecx
mov    %eax,%ebx
and    $0x7f,%ebx
or     %ecx,%ebx
test   $0x80,%al
je     114c <ue7_32+0x3c>
mov    (%r14),%edi
call   1030 <fgetc@plt>
cmp    (%r15),%eax
je     114c <ue7_32+0x3c>
mov    %ebx,%ecx
shl    $0x7,%ecx
mov    %eax,%ebx
and    $0x7f,%ebx
or     %ecx,%ebx
test   $0x80,%al
je     114c <ue7_32+0x3c>
mov    (%r14),%edi
call   1030 <fgetc@plt>
cmp    (%r15),%eax
je     114c <ue7_32+0x3c>
shl    $0x7,%ebx
and    $0x7f,%eax
or     %eax,%ebx
jmp    114c <ue7_32+0x3c>

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i32 0
define i32 @ue7_32() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %3
store i32 0, i32* %2
br label %5
5: ; preds = %28, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %31
8: ; preds = %5
%9 = load i32, i32* @stdin
%10 = call i32 @fgetc(i32 %9)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = load i32, i32* %3
store i32 %15, i32* %1
br label %33
16: ; preds = %8
%17 = load i32, i32* %3
%18 = shl i32 %17, 7
%19 = load i32, i32* %4
%20 = and i32 %19, 127
%21 = or i32 %18, %20
store i32 %21, i32* %3
%22 = load i32, i32* %4
%23 = and i32 %22, 128
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %16
%26 = load i32, i32* %3
store i32 %26, i32* %1
br label %33
27: ; preds = %16
br label %28
28: ; preds = %27
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %5
31: ; preds = %5
%32 = load i32, i32* %3
store i32 %32, i32* %1
br label %33
33: ; preds = %31, %25, %14
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i32 0
define i32 @ue7_32() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @fgetc(i32 %1)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %51, label %47
5: ; preds = %47
%6 = load i32, i32* @stdin
%7 = tail call i32 @fgetc(i32 %6)
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %51, label %10
10: ; preds = %5
%11 = shl nuw nsw i32 %48, 7
%12 = and i32 %7, 127
%13 = or i32 %12, %11
%14 = and i32 %7, 128
%15 = icmp eq i32 %14, 0
br i1 %15, label %51, label %16
16: ; preds = %10
%17 = load i32, i32* @stdin
%18 = tail call i32 @fgetc(i32 %17)
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %18, %19
br i1 %20, label %51, label %21
21: ; preds = %16
%22 = shl nuw nsw i32 %13, 7
%23 = and i32 %18, 127
%24 = or i32 %23, %22
%25 = and i32 %18, 128
%26 = icmp eq i32 %25, 0
br i1 %26, label %51, label %27
27: ; preds = %21
%28 = load i32, i32* @stdin
%29 = tail call i32 @fgetc(i32 %28)
%30 = load i32, i32* @EOF
%31 = icmp eq i32 %29, %30
br i1 %31, label %51, label %32
32: ; preds = %27
%33 = shl nuw nsw i32 %24, 7
%34 = and i32 %29, 127
%35 = or i32 %34, %33
%36 = and i32 %29, 128
%37 = icmp eq i32 %36, 0
br i1 %37, label %51, label %38
38: ; preds = %32
%39 = load i32, i32* @stdin
%40 = tail call i32 @fgetc(i32 %39)
%41 = load i32, i32* @EOF
%42 = icmp eq i32 %40, %41
br i1 %42, label %51, label %43
43: ; preds = %38
%44 = shl i32 %35, 7
%45 = and i32 %40, 127
%46 = or i32 %45, %44
br label %51
47: ; preds = %0
%48 = and i32 %2, 127
%49 = and i32 %2, 128
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %5
51: ; preds = %43, %38, %32, %27, %21, %16, %10, %5, %0, %47
%52 = phi i32 [ %48, %47 ], [ 0, %0 ], [ %48, %5 ], [ %13, %10 ], [ %13, %16 ], [ %24, %21 ], [ %24, %27 ], [ %35, %32 ], [ %35, %38 ], [ %46, %43 ]
ret i32 %52
}