unsigned int unsigned_int_max() {
  unsigned int d, d_p, step, max;
  int j, i, prov;
  i = j = step = d = d_p = prov = 0;
  d = 1;
  while (d > d_p) {
    ++i;
    d_p = d;
    d = d * 10;
  }
  d = d_p;
  step = d;
  while (step > 1) {
    step = step / 10;
    i = 0;
    max = 0;
    prov = 0;
    d_p = 0;
    while (prov == 0) {
      d_p = d + step;
      if (d_p < d)
        prov = 1;
      else {
        d = d + step;
      }
      ++i;
    }
  }
  return d;
}


x86 assembly (clang, -O0):
<unsigned_int_max>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jbe    115c <unsigned_int_max+0x5c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
imul   $0xa,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1135 <unsigned_int_max+0x35>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jbe    11e4 <unsigned_int_max+0xe4>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11df <unsigned_int_max+0xdf>
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    11c8 <unsigned_int_max+0xc8>
movl   $0x1,-0x1c(%rbp)
jmp    11d1 <unsigned_int_max+0xd1>
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119d <unsigned_int_max+0x9d>
jmp    1168 <unsigned_int_max+0x68>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsigned_int_max>:
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @unsigned_int_max() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %7
store i32 0, i32* %2
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %5
store i32 0, i32* %6
store i32 1, i32* %1
br label %8
8: ; preds = %12, %0
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp ugt i32 %9, %10
br i1 %11, label %12, label %18
12: ; preds = %8
%13 = load i32, i32* %6
%14 = add nsw i32 %13, 1
store i32 %14, i32* %6
%15 = load i32, i32* %1
store i32 %15, i32* %2
%16 = load i32, i32* %1
%17 = mul i32 %16, 10
store i32 %17, i32* %1
br label %8
18: ; preds = %8
%19 = load i32, i32* %2
store i32 %19, i32* %1
%20 = load i32, i32* %1
store i32 %20, i32* %3
br label %21
21: ; preds = %45, %18
%22 = load i32, i32* %3
%23 = icmp ugt i32 %22, 1
br i1 %23, label %24, label %46
24: ; preds = %21
%25 = load i32, i32* %3
%26 = udiv i32 %25, 10
store i32 %26, i32* %3
store i32 0, i32* %6
store i32 0, i32* %4
store i32 0, i32* %7
store i32 0, i32* %2
br label %27
27: ; preds = %42, %24
%28 = load i32, i32* %7
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %45
30: ; preds = %27
%31 = load i32, i32* %1
%32 = load i32, i32* %3
%33 = add i32 %31, %32
store i32 %33, i32* %2
%34 = load i32, i32* %2
%35 = load i32, i32* %1
%36 = icmp ult i32 %34, %35
br i1 %36, label %37, label %38
37: ; preds = %30
store i32 1, i32* %7
br label %42
38: ; preds = %30
%39 = load i32, i32* %1
%40 = load i32, i32* %3
%41 = add i32 %39, %40
store i32 %41, i32* %1
br label %42
42: ; preds = %38, %37
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
br label %27
45: ; preds = %27
br label %21
46: ; preds = %21
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
define i32 @unsigned_int_max() {
ret i32 -1
}