#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 */
unsigned int UINT_MAX;
unsigned int f(unsigned int n, unsigned int sum) {
  unsigned int i;
  i = UINT_MAX;
  do {
    sum += i % 13;
    i++;
  } while (i < n - 1);
  return sum;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ed7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xd,%ecx
xor    %edx,%edx
div    %ecx
add    -0x8(%rbp),%edx
mov    %edx,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jb     1116 <f+0x16>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%r9d
add    $0xffffffff,%edi
lea    0x1(%r9),%edx
cmp    %edx,%edi
cmova  %edi,%edx
mov    %esi,%eax
sub    %r9d,%edx
cmp    $0x8,%edx
jb     13c7 <f+0x2c7>
mov    %edx,%r8d
and    $0xfffffff8,%r8d
movd   %eax,%xmm1
movd   %r9d,%xmm0
pshufd $0x0,%xmm0,%xmm7
paddd  0xebf(%rip),%xmm7
lea    -0x8(%r8),%eax
mov    %eax,%esi
shr    $0x3,%esi
add    $0x1,%esi
test   %eax,%eax
je     1412 <f+0x312>
mov    %esi,%eax
and    $0xfffffffe,%eax
pxor   %xmm0,%xmm0
movdqa 0xea9(%rip),%xmm8
movdqa 0xeb0(%rip),%xmm12
movdqa 0xeb8(%rip),%xmm5
movdqa 0xebf(%rip),%xmm9
movdqa 0xec6(%rip),%xmm10
movdqa 0xecd(%rip),%xmm11
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movdqa %xmm7,%xmm2
paddd  %xmm8,%xmm2
movdqa %xmm7,%xmm6
pmuludq %xmm12,%xmm6
pshufd $0xed,%xmm6,%xmm6
pshufd $0xf5,%xmm7,%xmm3
pmuludq %xmm12,%xmm3
pshufd $0xed,%xmm3,%xmm3
punpckldq %xmm3,%xmm6
psrld  $0x2,%xmm6
pshufd $0xf5,%xmm6,%xmm3
pmuludq %xmm5,%xmm6
pshufd $0xe8,%xmm6,%xmm4
pmuludq %xmm5,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm4
movdqa %xmm7,%xmm6
psubd  %xmm4,%xmm6
paddd  %xmm1,%xmm6
movdqa %xmm2,%xmm1
pmuludq %xmm12,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm2,%xmm3
pmuludq %xmm12,%xmm3
pshufd $0xed,%xmm3,%xmm3
punpckldq %xmm3,%xmm1
psrld  $0x2,%xmm1
pshufd $0xf5,%xmm1,%xmm3
pmuludq %xmm5,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm5,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm1
psubd  %xmm1,%xmm2
paddd  %xmm0,%xmm2
movdqa %xmm7,%xmm1
paddd  %xmm9,%xmm1
movdqa %xmm7,%xmm0
paddd  %xmm10,%xmm0
movdqa %xmm1,%xmm3
pmuludq %xmm12,%xmm3
pshufd $0xed,%xmm3,%xmm3
pshufd $0xf5,%xmm1,%xmm4
pmuludq %xmm12,%xmm4
pshufd $0xed,%xmm4,%xmm4
punpckldq %xmm4,%xmm3
psrld  $0x2,%xmm3
pshufd $0xf5,%xmm3,%xmm4
pmuludq %xmm5,%xmm3
pshufd $0xe8,%xmm3,%xmm3
pmuludq %xmm5,%xmm4
pshufd $0xe8,%xmm4,%xmm4
punpckldq %xmm4,%xmm3
psubd  %xmm3,%xmm1
paddd  %xmm6,%xmm1
movdqa %xmm0,%xmm3
pmuludq %xmm12,%xmm3
pshufd $0xed,%xmm3,%xmm3
pshufd $0xf5,%xmm0,%xmm4
pmuludq %xmm12,%xmm4
pshufd $0xed,%xmm4,%xmm4
punpckldq %xmm4,%xmm3
psrld  $0x2,%xmm3
pshufd $0xf5,%xmm3,%xmm4
pmuludq %xmm5,%xmm3
pshufd $0xe8,%xmm3,%xmm3
pmuludq %xmm5,%xmm4
pshufd $0xe8,%xmm4,%xmm4
punpckldq %xmm4,%xmm3
psubd  %xmm3,%xmm0
paddd  %xmm2,%xmm0
paddd  %xmm11,%xmm7
add    $0xfffffffe,%eax
jne    11a0 <f+0xa0>
test   $0x1,%sil
je     13a5 <f+0x2a5>
movdqa 0xd0d(%rip),%xmm2
paddd  %xmm7,%xmm2
movdqa 0xd11(%rip),%xmm3
movdqa %xmm7,%xmm4
pmuludq %xmm3,%xmm4
pshufd $0xed,%xmm4,%xmm4
pshufd $0xf5,%xmm7,%xmm5
pmuludq %xmm3,%xmm5
pshufd $0xed,%xmm5,%xmm5
punpckldq %xmm5,%xmm4
psrld  $0x2,%xmm4
movdqa 0xcf5(%rip),%xmm5
pshufd $0xf5,%xmm4,%xmm6
pmuludq %xmm5,%xmm4
pshufd $0xe8,%xmm4,%xmm4
pmuludq %xmm5,%xmm6
pshufd $0xe8,%xmm6,%xmm6
punpckldq %xmm6,%xmm4
psubd  %xmm4,%xmm7
paddd  %xmm7,%xmm1
movdqa %xmm2,%xmm4
pmuludq %xmm3,%xmm4
pshufd $0xed,%xmm4,%xmm4
pshufd $0xf5,%xmm2,%xmm6
pmuludq %xmm3,%xmm6
pshufd $0xed,%xmm6,%xmm3
punpckldq %xmm3,%xmm4
psrld  $0x2,%xmm4
pshufd $0xf5,%xmm4,%xmm3
pmuludq %xmm5,%xmm4
pshufd $0xe8,%xmm4,%xmm4
pmuludq %xmm5,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm4
psubd  %xmm4,%xmm2
paddd  %xmm2,%xmm0
paddd  %xmm0,%xmm1
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%eax
cmp    %r8d,%edx
je     1411 <f+0x311>
add    %r8d,%r9d
lea    -0x1(%r9),%esi
nopl   0x0(%rax,%rax,1)
mov    %eax,%edx
mov    %r9d,%eax
imul   $0x4ec4ec4f,%rax,%rax
shr    $0x22,%rax
lea    (%rax,%rax,2),%ecx
lea    (%rax,%rcx,4),%ecx
mov    %r9d,%eax
sub    %ecx,%eax
add    %edx,%eax
add    $0x1,%r9d
add    $0x1,%esi
cmp    %edi,%r9d
jb     13d0 <f+0x2d0>
mov    %esi,%eax
imul   $0x4ec4ec4f,%rax,%rax
shr    $0x22,%rax
imul   $0xfffffff3,%eax,%eax
add    %edx,%eax
add    %r9d,%eax
add    $0xffffffff,%eax
ret
pxor   %xmm0,%xmm0
test   $0x1,%sil
jne    12fb <f+0x1fb>
jmp    13a5 <f+0x2a5>

LLVM IR (-O0):
@UINT_MAX = global i32 0
define i32 @f(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* @UINT_MAX
store i32 %6, i32* %5
br label %7
7: ; preds = %14, %2
%8 = load i32, i32* %5
%9 = urem i32 %8, 13
%10 = load i32, i32* %4
%11 = add i32 %10, %9
store i32 %11, i32* %4
%12 = load i32, i32* %5
%13 = add i32 %12, 1
store i32 %13, i32* %5
br label %14
14: ; preds = %7
%15 = load i32, i32* %5
%16 = load i32, i32* %3
%17 = sub i32 %16, 1
%18 = icmp ult i32 %15, %17
br i1 %18, label %7, label %19
19: ; preds = %14
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
@UINT_MAX = global i32 0
define i32 @f(i32 %0, i32 %1) {
%3 = load i32, i32* @UINT_MAX
%4 = add i32 %0, -1
%5 = add i32 %3, 1
%6 = call i32 @llvm.umax.i32(i32 %4, i32 %5)
%7 = sub i32 %6, %3
%8 = icmp ult i32 %7, 8
br i1 %8, label %61, label %9
9: ; preds = %2
%10 = and i32 %7, -8
%11 = add i32 %3, %10
%12 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %1, i64 0
%13 = insertelement <4 x i32> poison, i32 %3, i64 0
%14 = shufflevector <4 x i32> %13, <4 x i32> poison, <4 x i32> zeroinitializer
%15 = add <4 x i32> %14, <i32 0, i32 1, i32 2, i32 3>
%16 = add i32 %10, -8
%17 = lshr exact i32 %16, 3
%18 = add nuw nsw i32 %17, 1
%19 = and i32 %18, 1
%20 = icmp eq i32 %16, 0
br i1 %20, label %42, label %21
21: ; preds = %9
%22 = and i32 %18, 1073741822
br label %23
23: ; preds = %23, %21
%24 = phi <4 x i32> [ %12, %21 ], [ %37, %23 ]
%25 = phi <4 x i32> [ zeroinitializer, %21 ], [ %38, %23 ]
%26 = phi <4 x i32> [ %15, %21 ], [ %39, %23 ]
%27 = phi i32 [ 0, %21 ], [ %40, %23 ]
%28 = add <4 x i32> %26, <i32 4, i32 4, i32 4, i32 4>
%29 = urem <4 x i32> %26, <i32 13, i32 13, i32 13, i32 13>
%30 = urem <4 x i32> %28, <i32 13, i32 13, i32 13, i32 13>
%31 = add <4 x i32> %29, %24
%32 = add <4 x i32> %30, %25
%33 = add <4 x i32> %26, <i32 8, i32 8, i32 8, i32 8>
%34 = add <4 x i32> %26, <i32 12, i32 12, i32 12, i32 12>
%35 = urem <4 x i32> %33, <i32 13, i32 13, i32 13, i32 13>
%36 = urem <4 x i32> %34, <i32 13, i32 13, i32 13, i32 13>
%37 = add <4 x i32> %35, %31
%38 = add <4 x i32> %36, %32
%39 = add <4 x i32> %26, <i32 16, i32 16, i32 16, i32 16>
%40 = add i32 %27, 2
%41 = icmp eq i32 %40, %22
br i1 %41, label %42, label %23
42: ; preds = %23, %9
%43 = phi <4 x i32> [ undef, %9 ], [ %37, %23 ]
%44 = phi <4 x i32> [ undef, %9 ], [ %38, %23 ]
%45 = phi <4 x i32> [ %12, %9 ], [ %37, %23 ]
%46 = phi <4 x i32> [ zeroinitializer, %9 ], [ %38, %23 ]
%47 = phi <4 x i32> [ %15, %9 ], [ %39, %23 ]
%48 = icmp eq i32 %19, 0
br i1 %48, label %55, label %49
49: ; preds = %42
%50 = add <4 x i32> %47, <i32 4, i32 4, i32 4, i32 4>
%51 = urem <4 x i32> %47, <i32 13, i32 13, i32 13, i32 13>
%52 = urem <4 x i32> %50, <i32 13, i32 13, i32 13, i32 13>
%53 = add <4 x i32> %51, %45
%54 = add <4 x i32> %52, %46
br label %55
55: ; preds = %42, %49
%56 = phi <4 x i32> [ %43, %42 ], [ %53, %49 ]
%57 = phi <4 x i32> [ %44, %42 ], [ %54, %49 ]
%58 = add <4 x i32> %57, %56
%59 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %58)
%60 = icmp eq i32 %7, %10
br i1 %60, label %71, label %61
61: ; preds = %2, %55
%62 = phi i32 [ %1, %2 ], [ %59, %55 ]
%63 = phi i32 [ %3, %2 ], [ %11, %55 ]
br label %64
64: ; preds = %61, %64
%65 = phi i32 [ %68, %64 ], [ %62, %61 ]
%66 = phi i32 [ %69, %64 ], [ %63, %61 ]
%67 = urem i32 %66, 13
%68 = add i32 %67, %65
%69 = add i32 %66, 1
%70 = icmp ult i32 %69, %4
br i1 %70, label %64, label %71
71: ; preds = %64, %55
%72 = phi i32 [ %59, %55 ], [ %68, %64 ]
ret i32 %72
}