xunge/DecIR huggingface dataset:
__attribute__((no, noclone)) signed __int128 t112_2sub(signed __int128 y) {
  signed __int128 x =
      (((signed __int128)(((unsigned __int128)1 << (16 * 8 - 1)) - 1)));
  signed __int128 r;
  if (__builtin_sub_overflow(x, y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t112_2sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
movabs $0x7fffffffffffffff,%rax
ff ff 7f
mov    %rax,-0x38(%rbp)
movq   $0xffffffffffffffff,-0x40(%rbp)
ff
mov    -0x40(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rax
sub    %rsi,%rdx
sbb    %rax,%rcx
seto   %al
mov    %rdx,-0x50(%rbp)
mov    %rcx,-0x48(%rbp)
test   $0x1,%al
jne    1174 <t112_2sub+0x64>
jmp    117b <t112_2sub+0x6b>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x50(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t112_2sub>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
not    %r14
movabs $0x7fffffffffffffff,%rbx
ff ff 7f
sub    %rsi,%rbx
jno    1130 <t112_2sub+0x20>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %r14,%rax
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t112_2sub(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = alloca i128
%8 = bitcast i128* %4 to { i64, i64 }*
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 0
store i64 %0, i64* %9
%10 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 1
store i64 %1, i64* %10
%11 = load i128, i128* %4
store i128 %11, i128* %5
store i128 170141183460469231731687303715884105727, i128* %6
%12 = load i128, i128* %6
%13 = load i128, i128* %5
%14 = call { i128, i1 } @llvm.ssub.with.overflow.i128(i128 %12, i128 %13)
%15 = extractvalue { i128, i1 } %14, 1
%16 = extractvalue { i128, i1 } %14, 0
store i128 %16, i128* %7
br i1 %15, label %17, label %19
17: ; preds = %2
%18 = call i32 (...) @bar()
br label %19
19: ; preds = %17, %2
%20 = load i128, i128* %7
store i128 %20, i128* %3
%21 = bitcast i128* %3 to { i64, i64 }*
%22 = load { i64, i64 }, { i64, i64 }* %21
ret { i64, i64 } %22
}

LLVM IR (-O2):
define { i64, i64 } @t112_2sub(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = tail call { i128, i1 } @llvm.ssub.with.overflow.i128(i128 170141183460469231731687303715884105727, i128 %6)
%8 = extractvalue { i128, i1 } %7, 1
%9 = extractvalue { i128, i1 } %7, 0
br i1 %8, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i128 %9 to i64
%14 = lshr i128 %9, 64
%15 = trunc i128 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
/* Variables and functions */
int bit_weighted_count(int /*<<< orphan*/);
int /*<<< orphan*/ get_potential_moves(unsigned long long const,
                                       unsigned long long const);
int get_potential_mobility(const unsigned long long P,
                           const unsigned long long O) {
  return bit_weighted_count(get_potential_moves(P, O));
}


x86 assembly (clang, -O0):
<get_potential_mobility>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <get_potential_moves@plt>
mov    %eax,%edi
call   1030 <bit_weighted_count@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_potential_mobility>:
push   %rax
call   1040 <get_potential_moves@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <bit_weighted_count@plt>

LLVM IR (-O0):
define i32 @get_potential_mobility(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = call i32 @get_potential_moves(i64 %5, i64 %6)
%8 = call i32 @bit_weighted_count(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_potential_mobility(i64 %0, i64 %1) {
%3 = tail call i32 @get_potential_moves(i64 %0, i64 %1)
%4 = tail call i32 @bit_weighted_count(i32 %3)
ret i32 %4
}
void str_cat(char s1[], char s2[]) {
  int i = 0, j = 0;
  while (s1[i])
    ++i;
  while ((s1[i++] = s2[j++]))
    ;
}


x86 assembly (clang, -O0):
<str_cat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     113a <str_cat+0x3a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111a <str_cat+0x1a>
jmp    113f <str_cat+0x3f>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    -0x8(%rbp),%rcx
mov    -0x14(%rbp),%edx
mov    %edx,%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
movslq %edx,%rdx
mov    %al,(%rcx,%rdx,1)
cmp    $0x0,%al
je     1176 <str_cat+0x76>
jmp    113f <str_cat+0x3f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_cat>:
mov    $0xffffffff,%eax
mov    %rdi,%rcx
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <str_cat+0x10>
mov    %eax,%eax
add    %rax,%rdi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rsi,%rax,1),%ecx
mov    %cl,(%rdi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1130 <str_cat+0x30>
ret

LLVM IR (-O0):
define void @str_cat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %14, %2
%8 = load i8*, i8** %3
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %7
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
br label %7
17: ; preds = %7
br label %18
18: ; preds = %31, %17
%19 = load i8*, i8** %4
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
%22 = sext i32 %20 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
%24 = load i8, i8* %23
%25 = load i8*, i8** %3
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
%28 = sext i32 %26 to i64
%29 = getelementptr inbounds i8, i8* %25, i64 %28
store i8 %24, i8* %29
%30 = icmp ne i8 %24, 0
br i1 %30, label %31, label %32
31: ; preds = %18
br label %18
32: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @str_cat(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %8, %3 ], [ 0, %2 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add nuw i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = and i64 %4, 4294967295
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %14, %11 ]
%13 = phi i64 [ %10, %9 ], [ %17, %11 ]
%14 = add nuw i64 %12, 1
%15 = getelementptr inbounds i8, i8* %1, i64 %12
%16 = load i8, i8* %15
%17 = add nuw i64 %13, 1
%18 = getelementptr inbounds i8, i8* %0, i64 %13
store i8 %16, i8* %18
%19 = icmp eq i8 %16, 0
br i1 %19, label %20, label %11
20: ; preds = %11
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UARTCharPut(int, char);
int bwputc(char c) {
  UARTCharPut(((0x44E09000)), c);
  return 0;
}


x86 assembly (clang, -O0):
<bwputc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x44e09000,%edi
movsbl -0x1(%rbp),%esi
call   1030 <UARTCharPut@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bwputc>:
push   %rax
mov    %edi,%esi
mov    $0x44e09000,%edi
call   1030 <UARTCharPut@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @bwputc(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @UARTCharPut(i32 1155567616, i8 signext %3)
ret i32 0
}

LLVM IR (-O2):
define i32 @bwputc(i8 signext %0) {
%2 = tail call i32 @UARTCharPut(i32 1155567616, i8 signext %0)
ret i32 0
}
/* Variables and functions */
int f(int, int, int, int, int);
int /*<<< orphan*/ print_int(int);
int /*<<< orphan*/ print_string(char *);
void main(void) {
  int x;
  x = f(1, 2, 3, 4, 5);
  x = f(x, x, x, x, x);
  print_int(x);
  print_string("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
mov    $0x5,%r8d
call   1030 <f@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x4(%rbp),%ecx
mov    -0x4(%rbp),%r8d
call   1030 <f@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <print_int@plt>
lea    0xe7f(%rip),%rdi
call   1040 <print_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
mov    $0x5,%r8d
call   1030 <f@plt>
mov    %eax,%edi
mov    %eax,%esi
mov    %eax,%edx
mov    %eax,%ecx
mov    %eax,%r8d
call   1030 <f@plt>
mov    %eax,%edi
call   1050 <print_int@plt>
lea    0xe92(%rip),%rdi
pop    %rax
jmp    1040 <print_string@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca i32
%2 = call i32 @f(i32 1, i32 2, i32 3, i32 4, i32 5)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = load i32, i32* %1
%5 = load i32, i32* %1
%6 = load i32, i32* %1
%7 = load i32, i32* %1
%8 = call i32 @f(i32 %3, i32 %4, i32 %5, i32 %6, i32 %7)
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = call i32 @print_int(i32 %9)
%11 = call i32 @print_string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @main() {
%1 = tail call i32 @f(i32 1, i32 2, i32 3, i32 4, i32 5)
%2 = tail call i32 @f(i32 %1, i32 %1, i32 %1, i32 %1, i32 %1)
%3 = tail call i32 @print_int(i32 %2)
%4 = tail call i32 @print_string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
void swap(int *firstVar, int *secondVar) {
  int aux = *firstVar;
  *firstVar = *secondVar;
  *secondVar = aux;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @swap(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** %3
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
int fn5(int x) { return ~x | (unsigned)x; }


x86 assembly (clang, -O0):
<fn5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
or     -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fn5(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = xor i32 %3, -1
%5 = load i32, i32* %2
%6 = or i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @fn5(i32 %0) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ cluster_kmeans(double *, double *, int, int, int, int *);
int /*<<< orphan*/ lloyd_init_centroids(double *, double *, int, int, int);
void cluster_lloyd(double *centroids, double *samples, int dims,
                   int n_centroids, int n_samples, int *labels) {
  lloyd_init_centroids(centroids, samples, dims, n_centroids, n_samples);
  cluster_kmeans(centroids, samples, dims, n_centroids, n_samples, labels);
}


x86 assembly (clang, -O0):
<cluster_lloyd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
call   1030 <lloyd_init_centroids@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x28(%rbp),%r9
call   1040 <cluster_kmeans@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cluster_lloyd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <lloyd_init_centroids@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %r14,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <cluster_kmeans@plt>

LLVM IR (-O0):
define void @cluster_lloyd(double* %0, double* %1, i32 %2, i32 %3, i32 %4, i32* %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
store double* %0, double** %7
store double* %1, double** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32* %5, i32** %12
%13 = load double*, double** %7
%14 = load double*, double** %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = load i32, i32* %11
%18 = call i32 @lloyd_init_centroids(double* %13, double* %14, i32 %15, i32 %16, i32 %17)
%19 = load double*, double** %7
%20 = load double*, double** %8
%21 = load i32, i32* %9
%22 = load i32, i32* %10
%23 = load i32, i32* %11
%24 = load i32*, i32** %12
%25 = call i32 @cluster_kmeans(double* %19, double* %20, i32 %21, i32 %22, i32 %23, i32* %24)
ret void
}

LLVM IR (-O2):
define void @cluster_lloyd(double* %0, double* %1, i32 %2, i32 %3, i32 %4, i32* %5) {
%7 = tail call i32 @lloyd_init_centroids(double* %0, double* %1, i32 %2, i32 %3, i32 %4)
%8 = tail call i32 @cluster_kmeans(double* %0, double* %1, i32 %2, i32 %3, i32 %4, i32* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ crypto_scalarmult(unsigned char *, unsigned char const *,
                                     unsigned char const *);
int curve25519_dh(unsigned char *s, const unsigned char *pk,
                  const unsigned char *sk) {
  crypto_scalarmult(s, sk, pk);
  return 0;
}


x86 assembly (clang, -O0):
<curve25519_dh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <crypto_scalarmult@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<curve25519_dh>:
push   %rax
mov    %rsi,%rax
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <crypto_scalarmult@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @curve25519_dh(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %6
%9 = load i8*, i8** %5
%10 = call i32 @crypto_scalarmult(i8* %7, i8* %8, i8* %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @curve25519_dh(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @crypto_scalarmult(i8* %0, i8* %2, i8* %1)
ret i32 0
}
int select_col2_by_row(int row) { return 9 * 9 * 2 + row % (9 * 9); }


x86 assembly (clang, -O0):
<select_col2_by_row>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x51,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0xa2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<select_col2_by_row>:
movslq %edi,%rax
imul   $0x1948b0fd,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
lea    (%rcx,%rcx,8),%ecx
neg    %ecx
add    %ecx,%eax
add    $0xa2,%eax
ret

LLVM IR (-O0):
define i32 @select_col2_by_row(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 81
%5 = add nsw i32 162, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @select_col2_by_row(i32 %0) {
%2 = srem i32 %0, 81
%3 = add nsw i32 %2, 162
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char const *);
void set_color(const char *sColor) { printf("%s%s", "\033[", sColor); }


x86 assembly (clang, -O0):
<set_color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_color>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xee4(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [3 x i8] c"\1B[\00"
define void @set_color(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [3 x i8] c"\1B[\00"
define void @set_color(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
int do_state_75(char c, int *state, char *word, int *length) {
  switch (c) {
  case '/':
    *state = 76;
    break;
  case '*':
    break;
  case '\n':
    return 1;
  default:
    *state = 74;
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<do_state_75>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0xa,%eax
je     1161 <do_state_75+0x61>
jmp    112b <do_state_75+0x2b>
mov    -0x24(%rbp),%eax
sub    $0x2a,%eax
je     115c <do_state_75+0x5c>
jmp    113c <do_state_75+0x3c>
mov    -0x24(%rbp),%eax
sub    $0x2f,%eax
jne    116d <do_state_75+0x6d>
jmp    114d <do_state_75+0x4d>
mov    -0x10(%rbp),%rax
movl   $0x4c,(%rax)
jmp    1177 <do_state_75+0x77>
jmp    1177 <do_state_75+0x77>
movl   $0x1,-0x4(%rbp)
jmp    117e <do_state_75+0x7e>
mov    -0x10(%rbp),%rax
movl   $0x4a,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_state_75>:
cmp    $0xa,%edi
je     111e <do_state_75+0x1e>
cmp    $0x2a,%edi
je     111b <do_state_75+0x1b>
mov    $0x4c,%eax
cmp    $0x2f,%edi
je     1119 <do_state_75+0x19>
mov    $0x4a,%eax
mov    %eax,(%rsi)
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @do_state_75(i8 signext %0, i32* %1, i8* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32*
store i8 %0, i8* %6
store i32* %1, i32** %7
store i8* %2, i8** %8
store i32* %3, i32** %9
%10 = load i8, i8* %6
%11 = sext i8 %10 to i32
switch i32 %11, label %16 [
i32 47, label %12
i32 42, label %14
i32 10, label %15
]
12: ; preds = %4
%13 = load i32*, i32** %7
store i32 76, i32* %13
br label %18
14: ; preds = %4
br label %18
15: ; preds = %4
store i32 1, i32* %5
br label %19
16: ; preds = %4
%17 = load i32*, i32** %7
store i32 74, i32* %17
br label %18
18: ; preds = %16, %14, %12
store i32 0, i32* %5
br label %19
19: ; preds = %18, %15
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
define i32 @do_state_75(i8 signext %0, i32* nocapture writeonly %1, i8* nocapture readnone %2, i32* nocapture readnone %3) {
%5 = sext i8 %0 to i32
switch i32 %5, label %6 [
i32 47, label %7
i32 42, label %9
i32 10, label %10
]
6: ; preds = %4
br label %7
7: ; preds = %4, %6
%8 = phi i32 [ 74, %6 ], [ 76, %4 ]
store i32 %8, i32* %1
br label %9
9: ; preds = %7, %4
br label %10
10: ; preds = %4, %9
%11 = phi i32 [ 0, %9 ], [ 1, %4 ]
ret i32 %11
}
void sighand(int sig_num) {
  printf("\n %s: \n", __func__);
  printf(" abort signal rec'd \n");
  printf(" We can use this to perform clean up op's\n");
}


x86 assembly (clang, -O0):
<sighand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
lea    0xedf(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sighand>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed9(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xedc(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"\0A %s: \0A\00"
@__func__.sighand = [8 x i8] c"sighand\00"
@.str.1 = [22 x i8] c" abort signal rec'd \0A\00"
@.str.2 = [43 x i8] c" We can use this to perform clean up op's\0A\00"
define void @sighand(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__func__.sighand, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\0A %s: \0A\00"
@__func__.sighand = [8 x i8] c"sighand\00"
@str = [21 x i8] c" abort signal rec'd \00"
@str.3 = [42 x i8] c" We can use this to perform clean up op's\00"
define void @sighand(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__func__.sighand, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void usage() {
  printf("Parameters:\n");
  printf("[ -file <name> ]   The create/write/read/delete test will be done on "
         "<name>.<procNumber> (default %s)\n",
         "test_create_write_read_random");
  printf("[ -process <nb> ]  The test will be done by <nb> process "
         "simultaneously (default %d)\n",
         4);
  exit(0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0xf34(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf44(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xfa3(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0xf1c(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf2c(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Parameters:\0A\00"
@.str.1 = [103 x i8] c"[ -file <name> ] The create/write/read/delete test will be done on <name>.<procNumber> (default %s)\0A\00"
@.str.2 = [30 x i8] c"test_create_write_read_random\00"
@.str.3 = [86 x i8] c"[ -process <nb> ] The test will be done by <nb> process simultaneously (default %d)\0A\00"
define void @usage() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.3, i64 0, i64 0), i32 4)
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [103 x i8] c"[ -file <name> ] The create/write/read/delete test will be done on <name>.<procNumber> (default %s)\0A\00"
@.str.2 = [30 x i8] c"test_create_write_read_random\00"
@.str.3 = [86 x i8] c"[ -process <nb> ] The test will be done by <nb> process simultaneously (default %d)\0A\00"
@str = [12 x i8] c"Parameters:\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str.3, i64 0, i64 0), i32 4)
%4 = tail call i32 @exit(i32 0)
unreachable
}
void ar9003_hw_rtt_fill_hist(struct ath_hw *ah) {}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
ret

LLVM IR (-O0):
%struct.ath_hw = type opaque
define void @ar9003_hw_rtt_fill_hist(%struct.ath_hw* %0) {
%2 = alloca %struct.ath_hw*
store %struct.ath_hw* %0, %struct.ath_hw** %2
ret void
}

LLVM IR (-O2):
%struct.ath_hw = type opaque
define void @ar9003_hw_rtt_fill_hist(%struct.ath_hw* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test1();
int main(void) {
  test1();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <test1@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test1@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test1()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test1()
ret i32 0
}
int fnRecSum(int n) {
  if (n == 1)
    return 1;
  else
    return n + fnRecSum(n - 1);
}


x86 assembly (clang, -O0):
<fnRecSum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1131 <fnRecSum+0x21>
movl   $0x1,-0x4(%rbp)
jmp    114c <fnRecSum+0x3c>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fnRecSum@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnRecSum>:
mov    $0x1,%eax
cmp    $0x1,%edi
je     1124 <fnRecSum+0x24>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %ecx,%eax
lea    -0x3(%rdi),%edx
imul   %rcx,%rdx
shr    %rdx
add    %edi,%eax
sub    %edx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @fnRecSum(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %13
7: ; preds = %1
%8 = load i32, i32* %3
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = call i32 @fnRecSum(i32 %10)
%12 = add nsw i32 %8, %11
store i32 %12, i32* %2
br label %13
13: ; preds = %7, %6
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @fnRecSum(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = add i32 %0, -1
%5 = add i32 %0, -2
%6 = mul i32 %4, %5
%7 = zext i32 %5 to i33
%8 = add i32 %0, -3
%9 = zext i32 %8 to i33
%10 = mul i33 %7, %9
%11 = lshr i33 %10, 1
%12 = trunc i33 %11 to i32
%13 = add i32 %6, %0
%14 = sub i32 %13, %12
%15 = add i32 %14, 1
br label %16
16: ; preds = %3, %1
%17 = phi i32 [ 1, %1 ], [ %15, %3 ]
ret i32 %17
}
int test_imm_CEint32_reg(int val) { return ((val) & (0xCE << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_CEint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xce,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_CEint32_reg>:
test   $0xce,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_CEint32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 206
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_CEint32_reg(i32 %0) {
%2 = and i32 %0, 206
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
unsigned long CountLeadingZeroes(unsigned long arg) {
  return __builtin_clz(arg);
}


x86 assembly (clang, -O0):
<CountLeadingZeroes>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
bsr    %eax,%eax
xor    $0x1f,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<CountLeadingZeroes>:
bsr    %edi,%eax
xor    $0x1f,%eax
ret

LLVM IR (-O0):
define i64 @CountLeadingZeroes(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = call i32 @llvm.ctlz.i32(i32 %4, i1 true)
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
define i64 @CountLeadingZeroes(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i32 @llvm.ctlz.i32(i32 %2, i1 true)
%4 = zext i32 %3 to i64
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ pthread_self();
int /*<<< orphan*/ pthread_setname_np(int /*<<< orphan*/, char const *);
void task_name2(const char *name) { pthread_setname_np(pthread_self(), name); }


x86 assembly (clang, -O0):
<task_name2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
call   1030 <pthread_setname_np@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<task_name2>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <pthread_self@plt>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <pthread_setname_np@plt>

LLVM IR (-O0):
define void @task_name2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @pthread_self()
%4 = load i8*, i8** %2
%5 = call i32 @pthread_setname_np(i32 %3, i8* %4)
ret void
}

LLVM IR (-O2):
define void @task_name2(i8* %0) {
%2 = tail call i32 (...) @pthread_self()
%3 = tail call i32 @pthread_setname_np(i32 %2, i8* %0)
ret void
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMRE8_get(void) { return U_WMRCORENONE_get("U_WMRE8"); }


x86 assembly (clang, -O0):
<U_WMRE8_get>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <U_WMRCORENONE_get@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<U_WMRE8_get>:
lea    0xee9(%rip),%rdi
jmp    1030 <U_WMRCORENONE_get@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMRE8\00"
define i32 @U_WMRE8_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMRE8\00"
define i32 @U_WMRE8_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int e;
  unsigned x = 15;
  for (e = 1; x > 0; (x &= x - 1) && ++e)
    ;
  printf("x has %d 'on' bits\n", e - 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jbe    1170 <main+0x60>
jmp    113c <main+0x2c>
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
and    -0xc(%rbp),%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
je     1168 <main+0x58>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
jmp    112d <main+0x1d>
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"x has %d 'on' bits\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 15, i32* %3
store i32 1, i32* %2
br label %4
4: ; preds = %18, %0
%5 = load i32, i32* %3
%6 = icmp ugt i32 %5, 0
br i1 %6, label %7, label %21
7: ; preds = %4
br label %8
8: ; preds = %7
%9 = load i32, i32* %3
%10 = sub i32 %9, 1
%11 = load i32, i32* %3
%12 = and i32 %11, %10
store i32 %12, i32* %3
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %8
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
%17 = icmp ne i32 %16, 0
br label %18
18: ; preds = %14, %8
%19 = phi i1 [ false, %8 ], [ %17, %14 ]
%20 = zext i1 %19 to i32
br label %4
21: ; preds = %4
%22 = load i32, i32* %2
%23 = sub nsw i32 %22, 1
%24 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"x has %d 'on' bits\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage();
void both_b_and_d(void) {
  fprintf(stderr, "Cannot use both -d and -b options\n\n");
  usage();
}


x86 assembly (clang, -O0):
<both_b_and_d>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x0,%al
call   1040 <usage@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<both_b_and_d>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <usage@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"Cannot use both -d and -b options\0A\0A\00"
define void @both_b_and_d() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @usage()
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"Cannot use both -d and -b options\0A\0A\00"
define void @both_b_and_d() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @usage()
ret void
}
double test2(int cond, float a, double b) { return cond ? a : b; }


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112e <test2+0x2e>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1138 <test2+0x38>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
test   %edi,%edi
je     110b <test2+0xb>
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @test2(i32 %0, float %1, double %2) {
%4 = alloca i32
%5 = alloca float
%6 = alloca double
store i32 %0, i32* %4
store float %1, float* %5
store double %2, double* %6
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load float, float* %5
%11 = fpext float %10 to double
br label %14
12: ; preds = %3
%13 = load double, double* %6
br label %14
14: ; preds = %12, %9
%15 = phi double [ %11, %9 ], [ %13, %12 ]
ret double %15
}

LLVM IR (-O2):
define double @test2(i32 %0, float %1, double %2) {
%4 = icmp eq i32 %0, 0
%5 = fpext float %1 to double
%6 = select i1 %4, double %2, double %5
ret double %6
}
void _printfreelist(void) {}


x86 assembly (clang, -O0):
<_printfreelist>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_printfreelist>:
ret

LLVM IR (-O0):
define void @_printfreelist() {
ret void
}

LLVM IR (-O2):
define void @_printfreelist() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar_fd(char, int);
void ft_putstr_fd(char *str, int fd) {
  int i;
  i = 0;
  while (str[i] != '\0') {
    ft_putchar_fd(str[i], fd);
    i++;
  }
}


x86 assembly (clang, -O0):
<ft_putstr_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115f <ft_putstr_fd+0x4f>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0xc(%rbp),%esi
movsbl %al,%edi
call   1030 <ft_putchar_fd@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <ft_putstr_fd+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putstr_fd>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1145 <ft_putstr_fd+0x35>
mov    %esi,%ebp
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
mov    %ebp,%esi
call   1030 <ft_putchar_fd@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <ft_putstr_fd+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @ft_putstr_fd(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %14, %2
%7 = load i8*, i8** %3
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %6
%15 = load i8*, i8** %3
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = load i32, i32* %4
%21 = call i32 @ft_putchar_fd(i8 signext %19, i32 %20)
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %6
24: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @ft_putstr_fd(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8 [ %11, %5 ], [ %3, %2 ]
%8 = tail call i32 @ft_putchar_fd(i8 signext %7, i32 %1)
%9 = add nuw i64 %6, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
ret void
}
char *mus_audio_moniker(void) { return ("no audio support"); }


x86 assembly (clang, -O0):
<mus_audio_moniker>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mus_audio_moniker>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [17 x i8] c"no audio support\00"
define i8* @mus_audio_moniker() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [17 x i8] c"no audio support\00"
define i8* @mus_audio_moniker() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void prInt(int i) { printf("%d", i); }


x86 assembly (clang, -O0):
<prInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prInt>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @prInt(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @prInt(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put_c(char);
int /*<<< orphan*/ put_s(char *);
void main() {
  if (0xc == 014)
    put_s("\"egal\"\t\t(h,o)");
  else
    put_s("\"inegal\"\t\t(h,o)");
  if (20E-1 == 2.0 && 0.2e+1 == 0x2)
    put_c('=');
  else
    put_c('\\');
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <put_s@plt>
mov    $0x3d,%edi
call   1040 <put_c@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <put_s@plt>
mov    $0x3d,%edi
pop    %rax
jmp    1040 <put_c@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"\22egal\22\09\09(h,o)\00"
define void @main() {
%1 = call i32 @put_s(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @put_c(i8 signext 61)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"\22egal\22\09\09(h,o)\00"
define void @main() {
%1 = tail call i32 @put_s(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @put_c(i8 signext 61)
ret void
}
int get_number(void) {}


x86 assembly (clang, -O0):
<get_number>:
push   %rbp
mov    %rsp,%rbp
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_number>:
ret

LLVM IR (-O0):
define i32 @get_number() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @get_number() {
ret i32 undef
}
void bcm43xx_debugfs_add_device(struct bcm43xx_private *bcm) {}


x86 assembly (clang, -O0):
<bcm43xx_debugfs_add_device>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bcm43xx_debugfs_add_device>:
ret

LLVM IR (-O0):
%struct.bcm43xx_private = type opaque
define void @bcm43xx_debugfs_add_device(%struct.bcm43xx_private* %0) {
%2 = alloca %struct.bcm43xx_private*
store %struct.bcm43xx_private* %0, %struct.bcm43xx_private** %2
ret void
}

LLVM IR (-O2):
%struct.bcm43xx_private = type opaque
define void @bcm43xx_debugfs_add_device(%struct.bcm43xx_private* nocapture %0) {
ret void
}
void v4s(vec) short vec[4];
{
  float v[4];
  v[0] = vec[0];
  v[1] = vec[1];
  v[2] = vec[2];
  v[3] = vec[3];
  vcall(v, 4);
}


x86 assembly (clang, -O0):
<v4s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movswl 0x2(%rax),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movswl 0x4(%rax),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movswl 0x6(%rax),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <vcall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v4s>:
sub    $0x18,%rsp
movq   (%rdi),%xmm0
punpcklwd %xmm0,%xmm0
psrad  $0x10,%xmm0
cvtdq2ps %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <vcall@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @v4s(i16* %0) {
%2 = alloca i16*
%3 = alloca [4 x float]
store i16* %0, i16** %2
%4 = load i16*, i16** %2
%5 = getelementptr inbounds i16, i16* %4, i64 0
%6 = load i16, i16* %5
%7 = sitofp i16 %6 to float
%8 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 0
store float %7, float* %8
%9 = load i16*, i16** %2
%10 = getelementptr inbounds i16, i16* %9, i64 1
%11 = load i16, i16* %10
%12 = sitofp i16 %11 to float
%13 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 1
store float %12, float* %13
%14 = load i16*, i16** %2
%15 = getelementptr inbounds i16, i16* %14, i64 2
%16 = load i16, i16* %15
%17 = sitofp i16 %16 to float
%18 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 2
store float %17, float* %18
%19 = load i16*, i16** %2
%20 = getelementptr inbounds i16, i16* %19, i64 3
%21 = load i16, i16* %20
%22 = sitofp i16 %21 to float
%23 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 3
store float %22, float* %23
%24 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 0
%25 = call i32 (float*, i32, ...) bitcast (i32 (...)* @vcall to i32 (float*, i32, ...)*)(float* %24, i32 4)
ret void
}

LLVM IR (-O2):
define void @v4s(i16* nocapture %0) {
%2 = alloca <4 x float>
%3 = bitcast <4 x float>* %2 to i8*
%4 = getelementptr inbounds <4 x float>, <4 x float>* %2, i64 0, i64 0
%5 = bitcast i16* %0 to <4 x i16>*
%6 = load <4 x i16>, <4 x i16>* %5
%7 = sitofp <4 x i16> %6 to <4 x float>
store <4 x float> %7, <4 x float>* %2
%8 = call i32 (float*, i32, ...) bitcast (i32 (...)* @vcall to i32 (float*, i32, ...)*)(float* %4, i32 4)
ret void
}
char *get_state_name(int state) {
  switch (state) {
  case 0xa4:
    return "occupied";
    break;
  case 0xb8:
    return "freed";
    break;
  case 0xce:
    return "empty";
    break;
  default:
    return "?????";
    break;
  }
}


x86 assembly (clang, -O0):
<get_state_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0xa4,%eax
je     1143 <get_state_name+0x43>
jmp    111d <get_state_name+0x1d>
mov    -0x10(%rbp),%eax
sub    $0xb8,%eax
je     1153 <get_state_name+0x53>
jmp    1130 <get_state_name+0x30>
mov    -0x10(%rbp),%eax
sub    $0xce,%eax
je     1163 <get_state_name+0x63>
jmp    1173 <get_state_name+0x73>
lea    0xeb6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117e <get_state_name+0x7e>
lea    0xeaf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117e <get_state_name+0x7e>
lea    0xea5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117e <get_state_name+0x7e>
lea    0xe9b(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_state_name>:
cmp    $0xa4,%edi
je     1120 <get_state_name+0x20>
cmp    $0xce,%edi
je     1128 <get_state_name+0x28>
cmp    $0xb8,%edi
jne    1130 <get_state_name+0x30>
lea    0xeea(%rip),%rax
ret
lea    0xed9(%rip),%rax
ret
lea    0xee0(%rip),%rax
ret
lea    0xede(%rip),%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"occupied\00"
@.str.1 = [6 x i8] c"freed\00"
@.str.2 = [6 x i8] c"empty\00"
@.str.3 = [6 x i8] c"?????\00"
define i8* @get_state_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 164, label %5
i32 184, label %6
i32 206, label %7
]
5: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %2
br label %9
6: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %9
7: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %9
8: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [9 x i8] c"occupied\00"
@.str.1 = [6 x i8] c"freed\00"
@.str.2 = [6 x i8] c"empty\00"
@.str.3 = [6 x i8] c"?????\00"
define i8* @get_state_name(i32 %0) {
switch i32 %0, label %4 [
i32 164, label %5
i32 184, label %2
i32 206, label %3
]
2: ; preds = %1
br label %5
3: ; preds = %1
br label %5
4: ; preds = %1
br label %5
5: ; preds = %1, %4, %3, %2
%6 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %6
}