xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void *malloc(size_t);
int /*<<< orphan*/ perror(char *);
void *emalloc(size_t size) {
  void *r;
  if (!(r = malloc(size)))
    do {
      perror("malloc failed");
      exit(EXIT_FAILURE);
    } while (0);
  return r;
}


x86 assembly (clang, -O0):
<emalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1172 <emalloc+0x42>
jmp    1158 <emalloc+0x28>
lea    0xea1(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emalloc>:
push   %rax
call   1030 <malloc@plt>
test   %rax,%rax
je     113d <emalloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"malloc failed\00"
@EXIT_FAILURE = global i32 0
define i8* @emalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %13, label %7
7: ; preds = %1
br label %8
8: ; preds = %7
%9 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; No predecessors!
br label %13
13: ; preds = %12, %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@.str = [14 x i8] c"malloc failed\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @emalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret i8* %2
}
foo(int k, int j) {
  if (k >= 10) {
    if (j > k) {
      if (j > 0)
        return j;
    }
  }
  return j;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0xa,-0x8(%rbp)
jl     113f <foo+0x3f>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    113a <foo+0x3a>
cmpl   $0x0,-0xc(%rbp)
jle    1135 <foo+0x35>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1145 <foo+0x45>
jmp    113a <foo+0x3a>
jmp    113f <foo+0x3f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %esi,%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp sge i32 %6, 10
br i1 %7, label %8, label %19
8: ; preds = %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %18
12: ; preds = %8
%13 = load i32, i32* %5
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = load i32, i32* %5
store i32 %16, i32* %3
br label %21
17: ; preds = %12
br label %18
18: ; preds = %17, %8
br label %19
19: ; preds = %18, %2
%20 = load i32, i32* %5
store i32 %20, i32* %3
br label %21
21: ; preds = %19, %15
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 returned %1) {
ret i32 %1
}
int trailing_zeros(unsigned long n) {
  int c = 0;
  unsigned long tmp;
  for (tmp = n; tmp > 10; tmp = tmp / 10) {
    if ((tmp % 10) == 0)
      c++;
    else
      break;
  }
  return c;
}


x86 assembly (clang, -O0):
<trailing_zeros>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0xa,-0x18(%rbp)
jbe    1169 <trailing_zeros+0x69>
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
jne    1148 <trailing_zeros+0x48>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <trailing_zeros+0x4d>
jmp    1169 <trailing_zeros+0x69>
jmp    1152 <trailing_zeros+0x52>
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x18(%rbp)
jmp    1117 <trailing_zeros+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<trailing_zeros>:
movabs $0xcccccccccccccccd,%r8
cc cc cc
mov    %rdi,%rax
mul    %r8
xor    %ecx,%ecx
cmp    $0xb,%rdi
jb     1163 <trailing_zeros+0x63>
shr    $0x2,%rdx
and    $0xfffffffffffffffe,%rdx
lea    (%rdx,%rdx,4),%rax
mov    %rdi,%rdx
sub    %rax,%rdx
jne    1163 <trailing_zeros+0x63>
xor    %ecx,%ecx
xchg   %ax,%ax
mov    %rdi,%rsi
add    $0x1,%ecx
mov    %rdi,%rax
mul    %r8
mov    %rdx,%rdi
shr    $0x3,%rdi
mov    %rdi,%rax
mul    %r8
cmp    $0x6e,%rsi
jb     1163 <trailing_zeros+0x63>
shr    $0x2,%rdx
and    $0xfffffffffffffffe,%rdx
lea    (%rdx,%rdx,4),%rax
mov    %rdi,%rdx
sub    %rax,%rdx
je     1130 <trailing_zeros+0x30>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @trailing_zeros(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i64
store i64 %0, i64* %2
store i32 0, i32* %3
%5 = load i64, i64* %2
store i64 %5, i64* %4
br label %6
6: ; preds = %18, %1
%7 = load i64, i64* %4
%8 = icmp ugt i64 %7, 10
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load i64, i64* %4
%11 = urem i64 %10, 10
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %17
16: ; preds = %9
br label %21
17: ; preds = %13
br label %18
18: ; preds = %17
%19 = load i64, i64* %4
%20 = udiv i64 %19, 10
store i64 %20, i64* %4
br label %6
21: ; preds = %16, %6
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @trailing_zeros(i64 %0) {
%2 = icmp ugt i64 %0, 10
%3 = urem i64 %0, 10
%4 = icmp eq i64 %3, 0
%5 = and i1 %2, %4
br i1 %5, label %6, label %15
6: ; preds = %1, %6
%7 = phi i64 [ %10, %6 ], [ %0, %1 ]
%8 = phi i32 [ %9, %6 ], [ 0, %1 ]
%9 = add nuw nsw i32 %8, 1
%10 = udiv i64 %7, 10
%11 = icmp ugt i64 %7, 109
%12 = urem i64 %10, 10
%13 = icmp eq i64 %12, 0
%14 = and i1 %11, %13
br i1 %14, label %6, label %15
15: ; preds = %6, %1
%16 = phi i32 [ 0, %1 ], [ %9, %6 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void memory_free(void *mem) { free(mem); }


x86 assembly (clang, -O0):
<memory_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memory_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @memory_free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @free(i8* %3)
ret void
}

LLVM IR (-O2):
define void @memory_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
void yyerror(char *msg) {
  extern int line;
  fprintf(stderr, "ERRR!!! %s on line %d\n", msg, line);
}


x86 assembly (clang, -O0):
<yyerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    0x2eb8(%rip),%rax
mov    (%rax),%ecx
lea    0xec7(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yyerror>:
mov    %rdi,%rdx
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
mov    0x2ec5(%rip),%rax
mov    (%rax),%ecx
lea    0xed4(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"ERRR!!! %s on line %d\0A\00"
@line = external global i32
define void @yyerror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = load i32, i32* @line
%6 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %5)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"ERRR!!! %s on line %d\0A\00"
@line = external global i32
define void @yyerror(i8* %0) {
%2 = load i32, i32* @stderr
%3 = load i32, i32* @line
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %3)
ret void
}
int test_imm_26uint16_mem(unsigned short *val) {
  return ((*val) & (-0x26 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_26uint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0xffffffda,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_26uint16_mem>:
movzwl (%rdi),%eax
test   $0xffda,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_26uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -38
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ uvarint_encode32(int /*<<< orphan*/, int /*<<< orphan*/ *,
                                    int);
uint8_t *Num_To_Varint_32(uint32_t TOV32INPUT) {
  static uint8_t buffy_032[60] = {0};
  uvarint_encode32(TOV32INPUT, buffy_032, 60);
  return buffy_032;
}


x86 assembly (clang, -O0):
<Num_To_Varint_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0x2f1b(%rip),%rsi
mov    $0x3c,%edx
call   1030 <uvarint_encode32@plt>
lea    0x2f0a(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Num_To_Varint_32>:
push   %rbx
lea    0x2f28(%rip),%rbx
mov    %rbx,%rsi
mov    $0x3c,%edx
call   1030 <uvarint_encode32@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@Num_To_Varint_32.buffy_032 = internal global [60 x i32] zeroinitializer
define i32* @Num_To_Varint_32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @uvarint_encode32(i32 %3, i32* getelementptr inbounds ([60 x i32], [60 x i32]* @Num_To_Varint_32.buffy_032, i64 0, i64 0), i32 60)
ret i32* getelementptr inbounds ([60 x i32], [60 x i32]* @Num_To_Varint_32.buffy_032, i64 0, i64 0)
}

LLVM IR (-O2):
@Num_To_Varint_32.buffy_032 = internal global [60 x i32] zeroinitializer
define i32* @Num_To_Varint_32(i32 %0) {
%2 = tail call i32 @uvarint_encode32(i32 %0, i32* getelementptr inbounds ([60 x i32], [60 x i32]* @Num_To_Varint_32.buffy_032, i64 0, i64 0), i32 60)
ret i32* getelementptr inbounds ([60 x i32], [60 x i32]* @Num_To_Varint_32.buffy_032, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ itoa_padded(int, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  int n = 1;
  char s[12] = {0};
  itoa_padded(n, s, 12 - 1);
  printf("number character string is \'%s\'\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0xb,%edx
call   1050 <itoa_padded@plt>
lea    -0x14(%rbp),%rsi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
mov    %rsp,%rbx
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0xb,%edx
call   1040 <itoa_padded@plt>
lea    0xeaf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"number character string is '%s'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [12 x i8]
store i32 0, i32* %1
store i32 1, i32* %2
%4 = bitcast [12 x i8]* %3 to i8*
%5 = load i32, i32* %2
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%7 = call i32 @itoa_padded(i32 %5, i8* %6, i32 11)
%8 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"number character string is '%s'\0A\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 @itoa_padded(i32 1, i8* %2, i32 11)
%4 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
void ff_hevc_put_hevc_uni_epel_hv4_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_epel_hv4_10_sse4() {
ret void
}
int foo(int a) { return (int)(0 ? 0 : a ? a : 0.5); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1120 <foo+0x20>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1132 <foo+0x32>
movsd  0xed8(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1132 <foo+0x32>
movsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sitofp i32 %6 to double
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %5
%10 = phi double [ %7, %5 ], [ 5.000000e-01, %8 ]
%11 = fptosi double %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @foo(i32 returned %0) {
ret i32 %0
}
signed int compare(void *ptr, void *ptr2) { return (ptr == ptr2) ? 0 : 1; }


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rsi
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    %rsi,%rdx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
xor    %eax,%eax
cmp    %rsi,%rdi
setne  %al
ret

LLVM IR (-O0):
define i32 @compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = icmp eq i8* %5, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 0, i32 1
ret i32 %9
}

LLVM IR (-O2):
define i32 @compare(i8* readnone %0, i8* readnone %1) {
%3 = icmp ne i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ f();
int /*<<< orphan*/ g();
void h() {
  f();
  g();
}


x86 assembly (clang, -O0):
<h>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <f@plt>
mov    $0x0,%al
call   1040 <g@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<h>:
push   %rax
xor    %eax,%eax
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <g@plt>

LLVM IR (-O0):
define void @h() {
%1 = call i32 (...) @f()
%2 = call i32 (...) @g()
ret void
}

LLVM IR (-O2):
define void @h() {
%1 = tail call i32 (...) @f()
%2 = tail call i32 (...) @g()
ret void
}
int fun217() { return 217; }


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

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

LLVM IR (-O0):
define i32 @fun217() {
ret i32 217
}

LLVM IR (-O2):
define i32 @fun217() {
ret i32 217
}
int bar() {
  char c;
  asm("sarl $10, %%eax" : "=a"(c) : "0"(1000000));
  return c;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf4240,%eax
sar    $0xa,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
mov    $0xf4240,%eax
sar    $0xa,%eax
movsbl %al,%eax
ret

LLVM IR (-O0):
define i32 @bar() {
%1 = alloca i8
%2 = call i32 asm "sarl $$10, %eax", "={ax},0,~{dirflag},~{fpsr},~{flags}"(i32 1000000)
%3 = trunc i32 %2 to i8
store i8 %3, i8* %1
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @bar() {
%1 = tail call i32 asm "sarl $$10, %eax", "={ax},0,~{dirflag},~{fpsr},~{flags}"(i32 1000000)
%2 = shl i32 %1, 24
%3 = ashr exact i32 %2, 24
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ loginfo(char *);
int /*<<< orphan*/ rh_cache_flush();
void *rh_cache_flush_thread(void *null) {
  loginfo("Flush the resolved hostnames cache");
  rh_cache_flush();
  return 0;
}


x86 assembly (clang, -O0):
<rh_cache_flush_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <loginfo@plt>
mov    $0x0,%al
call   1040 <rh_cache_flush@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rh_cache_flush_thread>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <loginfo@plt>
xor    %eax,%eax
call   1040 <rh_cache_flush@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Flush the resolved hostnames cache\00"
define i8* @rh_cache_flush_thread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @loginfo(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @rh_cache_flush()
ret i8* null
}

LLVM IR (-O2):
@.str = [35 x i8] c"Flush the resolved hostnames cache\00"
define noalias i8* @rh_cache_flush_thread(i8* nocapture readnone %0) {
%2 = tail call i32 @loginfo(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @rh_cache_flush()
ret i8* null
}
void f_complete() {
  enum S1 { A = 3, C };
  if (1) {
    enum S1 { A = 10, B, C };
  }
}


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

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

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

LLVM IR (-O2):
define void @f_complete() {
ret void
}
unsigned long mpl_greatest_common_denom(unsigned long a, unsigned long b) {
  unsigned long t = 0;
  while (b) {
    t = b;
    b = a % b;
    a = t;
  }
  return a;
}


x86 assembly (clang, -O0):
<mpl_greatest_common_denom>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1144 <mpl_greatest_common_denom+0x44>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <mpl_greatest_common_denom+0x14>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpl_greatest_common_denom>:
mov    %rdi,%rax
test   %rsi,%rsi
je     1135 <mpl_greatest_common_denom+0x35>
mov    %rsi,%rdx
jmp    111d <mpl_greatest_common_denom+0x1d>
nopl   (%rax)
xor    %edx,%edx
div    %rcx
mov    %rcx,%rax
test   %rdx,%rdx
je     1132 <mpl_greatest_common_denom+0x32>
mov    %rdx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1110 <mpl_greatest_common_denom+0x10>
xor    %edx,%edx
div    %ecx
jmp    1115 <mpl_greatest_common_denom+0x15>
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @mpl_greatest_common_denom(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %9, %2
%7 = load i64, i64* %4
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = load i64, i64* %4
store i64 %10, i64* %5
%11 = load i64, i64* %3
%12 = load i64, i64* %4
%13 = urem i64 %11, %12
store i64 %13, i64* %4
%14 = load i64, i64* %5
store i64 %14, i64* %3
br label %6
15: ; preds = %6
%16 = load i64, i64* %3
ret i64 %16
}

LLVM IR (-O2):
define i64 @mpl_greatest_common_denom(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %7, %4 ], [ %1, %2 ]
%6 = phi i64 [ %5, %4 ], [ %0, %2 ]
%7 = urem i64 %6, %5
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i64 [ %0, %2 ], [ %5, %4 ]
ret i64 %10
}
int getRight(int i) { return 2 * i + 1; }


x86 assembly (clang, -O0):
<getRight>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRight>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @getRight(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 2, %3
%5 = add nsw i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @getRight(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = or i32 %2, 1
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int rx_timeout(int *, int, int);
int getBit(int *status, int timeout) {
  uint8_t mybuf[2];
  int rc = rx_timeout(mybuf, 1, timeout);
  if (status)
    *status = rc <= 0 ? 0 : 1;
  return *mybuf & 1;
}


x86 assembly (clang, -O0):
<getBit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x1,%esi
call   1030 <rx_timeout@plt>
mov    %eax,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1154 <getBit+0x44>
mov    -0x18(%rbp),%edx
mov    $0x1,%ecx
xor    %eax,%eax
cmp    $0x0,%edx
cmovle %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
and    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBit>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%edx
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
mov    $0x1,%esi
call   1030 <rx_timeout@plt>
test   %rbx,%rbx
je     1137 <getBit+0x27>
xor    %ecx,%ecx
test   %eax,%eax
setg   %cl
mov    %ecx,(%rbx)
mov    0x8(%rsp),%eax
and    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getBit(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca [2 x i32]
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%8 = load i32, i32* %4
%9 = call i32 @rx_timeout(i32* %7, i32 1, i32 %8)
store i32 %9, i32* %6
%10 = load i32*, i32** %3
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* %6
%14 = icmp sle i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 0, i32 1
%17 = load i32*, i32** %3
store i32 %16, i32* %17
br label %18
18: ; preds = %12, %2
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%20 = load i32, i32* %19
%21 = and i32 %20, 1
ret i32 %21
}

LLVM IR (-O2):
define i32 @getBit(i32* writeonly %0, i32 %1) {
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%6 = call i32 @rx_timeout(i32* %5, i32 1, i32 %1)
%7 = icmp eq i32* %0, null
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = icmp sgt i32 %6, 0
%10 = zext i1 %9 to i32
store i32 %10, i32* %0
br label %11
11: ; preds = %8, %2
%12 = load i32, i32* %5
%13 = and i32 %12, 1
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_instructions(void) {
  printf("Enter the racer's time in minutes and seconds (MM SS.SS) > ");
}


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

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

LLVM IR (-O0):
@.str = [60 x i8] c"Enter the racer's time in minutes and seconds (MM SS.SS) > \00"
define void @print_instructions() {
%1 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [60 x i8] c"Enter the racer's time in minutes and seconds (MM SS.SS) > \00"
define void @print_instructions() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("!!!Hello World!!!\n");
  printf("!!!Hello CMake!!!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xee1(%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
call   1030 <puts@plt>
lea    0xeee(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"!!!Hello World!!!\0A\00"
@.str.1 = [19 x i8] c"!!!Hello CMake!!!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [18 x i8] c"!!!Hello World!!!\00"
@str.2 = [18 x i8] c"!!!Hello CMake!!!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int UINT32_C(int);
int UINT64_C(int);
void fiat_p224_msat(uint64_t out1[5]) {
  out1[0] = 0x1;
  out1[1] = UINT64_C(0xffffffff00000000);
  out1[2] = UINT64_C(0xffffffffffffffff);
  out1[3] = UINT32_C(0xffffffff);
  out1[4] = 0x0;
}


x86 assembly (clang, -O0):
<fiat_p224_msat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
xor    %edi,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    $0xffffffff,%edi
call   1040 <UINT32_C@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x10(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fiat_p224_msat>:
push   %rbx
mov    %rdi,%rbx
movl   $0x1,(%rdi)
xor    %edi,%edi
call   1030 <UINT64_C@plt>
mov    %eax,0x4(%rbx)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,0x8(%rbx)
mov    $0xffffffff,%edi
call   1040 <UINT32_C@plt>
mov    %eax,0xc(%rbx)
movl   $0x0,0x10(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @fiat_p224_msat(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
store i32 1, i32* %4
%5 = call i32 @UINT64_C(i32 0)
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 1
store i32 %5, i32* %7
%8 = call i32 @UINT64_C(i32 -1)
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 2
store i32 %8, i32* %10
%11 = call i32 @UINT32_C(i32 -1)
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 3
store i32 %11, i32* %13
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 4
store i32 0, i32* %15
ret void
}

LLVM IR (-O2):
define void @fiat_p224_msat(i32* nocapture writeonly %0) {
store i32 1, i32* %0
%2 = tail call i32 @UINT64_C(i32 0)
%3 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %2, i32* %3
%4 = tail call i32 @UINT64_C(i32 -1)
%5 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %4, i32* %5
%6 = tail call i32 @UINT32_C(i32 -1)
%7 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %6, i32* %7
%8 = getelementptr inbounds i32, i32* %0, i64 4
store i32 0, i32* %8
ret void
}
unsigned int hash_value(char *s) {
  unsigned int h;
  for (h = 0; *s != '\0'; s++)
    h = *s + 31 * h;
  return (h % (10 - 1)) + 1;
}


x86 assembly (clang, -O0):
<hash_value>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1140 <hash_value+0x40>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
imul   $0x1f,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <hash_value+0xf>
mov    -0xc(%rbp),%eax
mov    $0x9,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_value>:
mov    (%rdi),%cl
test   %cl,%cl
je     1141 <hash_value+0x41>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
mov    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash_value+0x10>
mov    %eax,%ecx
imul   $0x38e38e39,%rcx,%rcx
shr    $0x21,%rcx
lea    (%rcx,%rcx,8),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @hash_value(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul i32 %6, 31
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = urem i32 %10, 9
%16 = add nuw nsw i32 %15, 1
br label %17
17: ; preds = %14, %1
%18 = phi i32 [ 1, %1 ], [ %16, %14 ]
ret i32 %18
}
/* Type definitions */
struct minix_dir_entry {
  int dummy;
};

/* Variables and functions */
int mx_read_write_dir_entry(int, int, int, struct minix_dir_entry *, int);
int mx_write_dir_entry(int device, int inodenr, int entrynr,
                       struct minix_dir_entry *entry) {
  return mx_read_write_dir_entry(device, inodenr, entrynr, entry, 1);
}


x86 assembly (clang, -O0):
<mx_write_dir_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%r8d
call   1030 <mx_read_write_dir_entry@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mx_write_dir_entry>:
mov    $0x1,%r8d
jmp    1030 <mx_read_write_dir_entry@plt>

LLVM IR (-O0):
%struct.minix_dir_entry = type { i32 }
define i32 @mx_write_dir_entry(i32 %0, i32 %1, i32 %2, %struct.minix_dir_entry* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.minix_dir_entry*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store %struct.minix_dir_entry* %3, %struct.minix_dir_entry** %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load %struct.minix_dir_entry*, %struct.minix_dir_entry** %8
%13 = call i32 @mx_read_write_dir_entry(i32 %9, i32 %10, i32 %11, %struct.minix_dir_entry* %12, i32 1)
ret i32 %13
}

LLVM IR (-O2):
%struct.minix_dir_entry = type { i32 }
define i32 @mx_write_dir_entry(i32 %0, i32 %1, i32 %2, %struct.minix_dir_entry* %3) {
%5 = tail call i32 @mx_read_write_dir_entry(i32 %0, i32 %1, i32 %2, %struct.minix_dir_entry* %3, i32 1)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ __short_int_memset(void *, int, size_t);
void __wrd_memset(void *__restrict s, int c, size_t n) {
  int sc = ((c << 8) + (char)c);
  __short_int_memset(s, sc, n);
}


x86 assembly (clang, -O0):
<__wrd_memset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
mov    -0xc(%rbp),%ecx
movsbl %cl,%ecx
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <__short_int_memset@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__wrd_memset>:
movsbl %sil,%eax
shl    $0x8,%esi
add    %esi,%eax
mov    %eax,%esi
jmp    1030 <__short_int_memset@plt>

LLVM IR (-O0):
define void @__wrd_memset(i8* noalias %0, i32 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%8 = load i32, i32* %5
%9 = shl i32 %8, 8
%10 = load i32, i32* %5
%11 = trunc i32 %10 to i8
%12 = sext i8 %11 to i32
%13 = add nsw i32 %9, %12
store i32 %13, i32* %7
%14 = load i8*, i8** %4
%15 = load i32, i32* %7
%16 = load i64, i64* %6
%17 = call i32 @__short_int_memset(i8* %14, i32 %15, i64 %16)
ret void
}

LLVM IR (-O2):
define void @__wrd_memset(i8* noalias %0, i32 %1, i64 %2) {
%4 = shl i32 %1, 8
%5 = shl i32 %1, 24
%6 = ashr exact i32 %5, 24
%7 = add nsw i32 %6, %4
%8 = tail call i32 @__short_int_memset(i8* %0, i32 %7, i64 %2)
ret void
}
/* Variables and functions */
unsigned char *hmac_generic(unsigned char *,
                            unsigned char *(*)(unsigned char *,
                                               unsigned char const *, size_t),
                            size_t, size_t, unsigned char const *, size_t,
                            unsigned char const *, size_t);
unsigned char *
mac_hmac_hash(unsigned char *out,
              unsigned char *(*hash)(unsigned char *out,
                                     const unsigned char *in, size_t in_len),
              size_t hash_len, size_t hash_block_size, const unsigned char *key,
              size_t key_len, const unsigned char *msg, size_t msg_len) {
  return hmac_generic(out, hash, hash_len, hash_block_size, key, key_len, msg,
                      msg_len);
}


x86 assembly (clang, -O0):
<mac_hmac_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <hmac_generic@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mac_hmac_hash>:
jmp    1030 <hmac_generic@plt>

LLVM IR (-O0):
define i8* @mac_hmac_hash(i8* %0, i8* (i8*, i8*, i64)* %1, i64 %2, i64 %3, i8* %4, i64 %5, i8* %6, i64 %7) {
%9 = alloca i8*
%10 = alloca i8* (i8*, i8*, i64)*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i64
%15 = alloca i8*
%16 = alloca i64
store i8* %0, i8** %9
store i8* (i8*, i8*, i64)* %1, i8* (i8*, i8*, i64)** %10
store i64 %2, i64* %11
store i64 %3, i64* %12
store i8* %4, i8** %13
store i64 %5, i64* %14
store i8* %6, i8** %15
store i64 %7, i64* %16
%17 = load i8*, i8** %9
%18 = load i8* (i8*, i8*, i64)*, i8* (i8*, i8*, i64)** %10
%19 = load i64, i64* %11
%20 = load i64, i64* %12
%21 = load i8*, i8** %13
%22 = load i64, i64* %14
%23 = load i8*, i8** %15
%24 = load i64, i64* %16
%25 = call i8* @hmac_generic(i8* %17, i8* (i8*, i8*, i64)* %18, i64 %19, i64 %20, i8* %21, i64 %22, i8* %23, i64 %24)
ret i8* %25
}

LLVM IR (-O2):
define i8* @mac_hmac_hash(i8* %0, i8* (i8*, i8*, i64)* %1, i64 %2, i64 %3, i8* %4, i64 %5, i8* %6, i64 %7) {
%9 = tail call i8* @hmac_generic(i8* %0, i8* (i8*, i8*, i64)* %1, i64 %2, i64 %3, i8* %4, i64 %5, i8* %6, i64 %7)
ret i8* %9
}
int bazl(int i) { return i + 2; }


x86 assembly (clang, -O0):
<bazl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bazl>:
lea    0x2(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @bazl(i32 %0) {
%2 = add nsw i32 %0, 2
ret i32 %2
}
float i_to_float(int i) { return i; }


x86 assembly (clang, -O0):
<i_to_float>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<i_to_float>:
cvtsi2ss %edi,%xmm0
ret

LLVM IR (-O0):
define float @i_to_float(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to float
ret float %4
}

LLVM IR (-O2):
define float @i_to_float(i32 %0) {
%2 = sitofp i32 %0 to float
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ process(char *);
char *strdupe(char *);
char *strtok(char *, char *);
void procstr(char *s) {
  char *h = strdupe(s);
  char *g;
  g = strtok(h, " ");
  while (g) {
    process(g);
    g = strtok(NULL, " ");
  }
  free(h);
}


x86 assembly (clang, -O0):
<procstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strdupe@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     119a <procstr+0x5a>
mov    -0x18(%rbp),%rdi
call   1040 <process@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe74(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x18(%rbp)
jmp    116d <procstr+0x2d>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<procstr>:
push   %r14
push   %rbx
push   %rax
call   1060 <strdupe@plt>
mov    %rax,%r14
lea    0xead(%rip),%rsi
mov    %rax,%rdi
call   1050 <strtok@plt>
test   %rax,%rax
je     1187 <procstr+0x47>
lea    0xe99(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1040 <process@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <strtok@plt>
test   %rax,%rax
jne    1170 <procstr+0x30>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define void @procstr(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strdupe(i8* %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i8* @strtok(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** %4
br label %9
9: ; preds = %12, %1
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i8*, i8** %4
%14 = call i32 @process(i8* %13)
%15 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %15, i8** %4
br label %9
16: ; preds = %9
%17 = load i8*, i8** %3
%18 = call i32 @free(i8* %17)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define void @procstr(i8* %0) {
%2 = tail call i8* @strdupe(i8* %0)
%3 = tail call i8* @strtok(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %10, label %5
5: ; preds = %1, %5
%6 = phi i8* [ %8, %5 ], [ %3, %1 ]
%7 = tail call i32 @process(i8* %6)
%8 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %5
10: ; preds = %5, %1
%11 = tail call i32 @free(i8* %2)
ret void
}
void check_logfs_journal_header(void) { ; }


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

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

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

LLVM IR (-O2):
define void @check_logfs_journal_header() {
ret void
}
int test_imm_8Cuint16_reg(unsigned short val) {
  return ((val) & (-0x8C << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_8Cuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff74,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_8Cuint16_reg>:
test   $0xff74,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_8Cuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -140
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct gg_http {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ errno;
int gg_userlist_remove_watch_fd(struct gg_http *h) {
  errno = EINVAL;
  return -1;
}


x86 assembly (clang, -O0):
<gg_userlist_remove_watch_fd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ec9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec8(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gg_userlist_remove_watch_fd>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.gg_http = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @gg_userlist_remove_watch_fd(%struct.gg_http* %0) {
%2 = alloca %struct.gg_http*
store %struct.gg_http* %0, %struct.gg_http** %2
%3 = load i32, i32* @EINVAL
store i32 %3, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.gg_http = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @gg_userlist_remove_watch_fd(%struct.gg_http* nocapture readnone %0) {
%2 = load i32, i32* @EINVAL
store i32 %2, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ user_dialogue(int *);
int main(int argc, char *argv[]) {
  int stop = 0;
  while (stop == 0) {
    user_dialogue(&stop);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1145 <main+0x35>
lea    -0x14(%rbp),%rdi
call   1030 <user_dialogue@plt>
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <user_dialogue@plt>
cmpl   $0x0,0xc(%rsp)
je     1130 <main+0x20>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %2, %5
%6 = call i32 @user_dialogue(i32* %3)
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %5, label %9
9: ; preds = %5
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ hdmi_hw_powerdown();
int /*<<< orphan*/ tvafe_hw_powerdown();
int /*<<< orphan*/ vdin_hw_powerdown(int);
void tvin_powerdown(void) {
  tvafe_hw_powerdown();
  hdmi_hw_powerdown();
  vdin_hw_powerdown(0x00);
  vdin_hw_powerdown(0x70);
}


x86 assembly (clang, -O0):
<tvin_powerdown>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <tvafe_hw_powerdown@plt>
mov    $0x0,%al
call   1040 <hdmi_hw_powerdown@plt>
xor    %edi,%edi
call   1030 <vdin_hw_powerdown@plt>
mov    $0x70,%edi
call   1030 <vdin_hw_powerdown@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tvin_powerdown>:
push   %rax
xor    %eax,%eax
call   1050 <tvafe_hw_powerdown@plt>
xor    %eax,%eax
call   1040 <hdmi_hw_powerdown@plt>
xor    %edi,%edi
call   1030 <vdin_hw_powerdown@plt>
mov    $0x70,%edi
pop    %rax
jmp    1030 <vdin_hw_powerdown@plt>

LLVM IR (-O0):
define void @tvin_powerdown() {
%1 = call i32 (...) @tvafe_hw_powerdown()
%2 = call i32 (...) @hdmi_hw_powerdown()
%3 = call i32 @vdin_hw_powerdown(i32 0)
%4 = call i32 @vdin_hw_powerdown(i32 112)
ret void
}

LLVM IR (-O2):
define void @tvin_powerdown() {
%1 = tail call i32 (...) @tvafe_hw_powerdown()
%2 = tail call i32 (...) @hdmi_hw_powerdown()
%3 = tail call i32 @vdin_hw_powerdown(i32 0)
%4 = tail call i32 @vdin_hw_powerdown(i32 112)
ret void
}
void ff_hevc_put_hevc_bi_pel_pixels32_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_pel_pixels32_10_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void numbers() {
  printf("%f\n", 5 + 4.5);
  printf("%d\n", 5 + 4);
  printf("%d\n", 5 / 4);
  printf("%f\n", 5 / 4.0);
  int num = 6;
  printf("%d\n", num);
}


x86 assembly (clang, -O0):
<numbers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
movl   $0x6,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numbers>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%r14
mov    %r14,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
lea    0xed5(%rip),%rbx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @numbers() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 9)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 9)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 6)
ret void
}