xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *);
int main() {
  uint32_t valor = 2;
  if (valor > 10) {
    printf("Valor mayor de 10\n");
    return EXIT_FAILURE;
  }
  assert(valor % 2 == 0);
  printf("El numero es primo\n");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jle    115d <main+0x3d>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1190 <main+0x70>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1040 <assert@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Valor mayor de 10\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [20 x i8] c"El numero es primo\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 10
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
store i32 %7, i32* %1
br label %16
8: ; preds = %0
%9 = load i32, i32* %2
%10 = srem i32 %9, 2
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @EXIT_SUCCESS
store i32 %15, i32* %1
br label %16
16: ; preds = %8, %5
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [19 x i8] c"El numero es primo\00"
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
/* Variables and functions */
int my_putnbr_base(int, int);
int my_putnbr(int i) { return my_putnbr_base(i, 10); }


x86 assembly (clang, -O0):
<my_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xa,%esi
call   1030 <my_putnbr_base@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_putnbr>:
mov    $0xa,%esi
jmp    1030 <my_putnbr_base@plt>

LLVM IR (-O0):
define i32 @my_putnbr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @my_putnbr_base(i32 %3, i32 10)
ret i32 %4
}

LLVM IR (-O2):
define i32 @my_putnbr(i32 %0) {
%2 = tail call i32 @my_putnbr_base(i32 %0, i32 10)
ret i32 %2
}
/* Type definitions */
struct eap_sm {
  int dummy;
};
struct eap_gtc_data {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct eap_gtc_data *);
void eap_gtc_deinit(struct eap_sm *sm, void *priv) {
  struct eap_gtc_data *data = priv;
  free(data);
}


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

x86 assembly (clang, -O2):
<eap_gtc_deinit>:
mov    %rsi,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.eap_sm = type { i32 }
%struct.eap_gtc_data = type { i32 }
define void @eap_gtc_deinit(%struct.eap_sm* %0, i8* %1) {
%3 = alloca %struct.eap_sm*
%4 = alloca i8*
%5 = alloca %struct.eap_gtc_data*
store %struct.eap_sm* %0, %struct.eap_sm** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to %struct.eap_gtc_data*
store %struct.eap_gtc_data* %7, %struct.eap_gtc_data** %5
%8 = load %struct.eap_gtc_data*, %struct.eap_gtc_data** %5
%9 = call i32 @free(%struct.eap_gtc_data* %8)
ret void
}

LLVM IR (-O2):
%struct.eap_sm = type { i32 }
%struct.eap_gtc_data = type { i32 }
define void @eap_gtc_deinit(%struct.eap_sm* nocapture readnone %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to %struct.eap_gtc_data*
%4 = tail call i32 @free(%struct.eap_gtc_data* %3)
ret void
}
/* Variables and functions */
const char *findchar_fast(const char *buf, const char *buf_end,
                          const char *ranges, size_t ranges_size, int *found) {
  *found = 0;
  (void)buf_end;
  (void)ranges;
  (void)ranges_size;
  return buf;
}


x86 assembly (clang, -O0):
<findchar_fast>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<findchar_fast>:
mov    %rdi,%rax
movl   $0x0,(%r8)
ret

LLVM IR (-O0):
define i8* @findchar_fast(i8* %0, i8* %1, i8* %2, i64 %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i64 %3, i64* %9
store i32* %4, i32** %10
%11 = load i32*, i32** %10
store i32 0, i32* %11
%12 = load i8*, i8** %7
%13 = load i8*, i8** %8
%14 = load i64, i64* %9
%15 = load i8*, i8** %6
ret i8* %15
}

LLVM IR (-O2):
define i8* @findchar_fast(i8* readnone returned %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i64 %3, i32* nocapture writeonly %4) {
store i32 0, i32* %4
ret i8* %0
}
int main(void) {
  int i;
  int value = 1;
  for (i = 0; i < 5; i++) {
    value = 2 * value;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    113a <main+0x3a>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
scalar_t__ jsV_numbertoint32(double);
unsigned int jsV_numbertouint32(double n) {
  return (unsigned int)jsV_numbertoint32(n);
}


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

x86 assembly (clang, -O2):
<jsV_numbertouint32>:
jmp    1030 <jsV_numbertoint32@plt>

LLVM IR (-O0):
define i32 @jsV_numbertouint32(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @jsV_numbertoint32(double %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @jsV_numbertouint32(double %0) {
%2 = tail call i64 @jsV_numbertoint32(double %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
void zc3xx_stopN(struct usb_spca50x *spca50x) {}


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

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

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

LLVM IR (-O2):
%struct.usb_spca50x = type opaque
define void @zc3xx_stopN(%struct.usb_spca50x* nocapture %0) {
ret void
}
void cw_decode(void) {}


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

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

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

LLVM IR (-O2):
define void @cw_decode() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("Hello, World!\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"Hello, World!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int);
main() {
  int c;
  printf("%d", c = EOF);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
mov    %esi,-0x4(%rbp)
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i32 0
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ msg;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ write(int, char *, int);
void _Unwind_Resume_or_Rethrow() {
  char msg[] = "Aborting: "
               "_Unwind_Resume_or_Rethrow"
               " called "
               "(C++ exception handling is disabled)\n";
  write(2, msg, sizeof(msg) - 1);
  abort();
}


x86 assembly (clang, -O0):
<_Unwind_Resume_or_Rethrow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x60(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x51,%edx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rsi
mov    $0x2,%edi
mov    $0x50,%edx
call   1040 <write@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<_Unwind_Resume_or_Rethrow>:
sub    $0x58,%rsp
movaps 0xf15(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xedd(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea5(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x50(%rsp)
mov    %rsp,%rsi
mov    $0x2,%edi
mov    $0x50,%edx
call   1040 <write@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@__const._Unwind_Resume_or_Rethrow.msg = [81 x i8] c"Aborting: _Unwind_Resume_or_Rethrow called (C++ exception handling is disabled)\0A\00"
define void @_Unwind_Resume_or_Rethrow() {
%1 = alloca [81 x i8]
%2 = bitcast [81 x i8]* %1 to i8*
%3 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%4 = call i32 @write(i32 2, i8* %3, i32 80)
%5 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@__const._Unwind_Resume_or_Rethrow.msg = [81 x i8] c"Aborting: _Unwind_Resume_or_Rethrow called (C++ exception handling is disabled)\0A\00"
define void @_Unwind_Resume_or_Rethrow() {
%1 = alloca [81 x i8]
%2 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%3 = call i32 @write(i32 2, i8* %2, i32 80)
%4 = tail call i32 (...) @abort()
unreachable
}
void print_inst_RS_RS_RD(char *mnemonic, int rs1, int rs2, int rd) { ; }


x86 assembly (clang, -O0):
<print_inst_RS_RS_RD>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @print_inst_RS_RS_RD(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret void
}

LLVM IR (-O2):
define void @print_inst_RS_RS_RD(i8* nocapture %0, i32 %1, i32 %2, i32 %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lcd_area(int, int /*<<< orphan*/, int, int, int);
int /*<<< orphan*/ lcd_string(char *, int, int, int, int, int);
void s_setup_root_draw(void) {
  lcd_area(24, 0, 9, 30, 0x00F);
  lcd_string("SETUP", 25, 1, 1, 0xFFF, 0x00F);
}


x86 assembly (clang, -O0):
<s_setup_root_draw>:
push   %rbp
mov    %rsp,%rbp
mov    $0x18,%edi
xor    %esi,%esi
mov    $0x9,%edx
mov    $0x1e,%ecx
mov    $0xf,%r8d
call   1030 <lcd_area@plt>
lea    0xeb9(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%ecx
mov    $0xfff,%r8d
mov    $0xf,%r9d
mov    %ecx,%edx
call   1040 <lcd_string@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_setup_root_draw>:
push   %rax
mov    $0x18,%edi
xor    %esi,%esi
mov    $0x9,%edx
mov    $0x1e,%ecx
mov    $0xf,%r8d
call   1030 <lcd_area@plt>
lea    0xebc(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    $0xfff,%r8d
mov    $0xf,%r9d
pop    %rax
jmp    1040 <lcd_string@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"SETUP\00"
define void @s_setup_root_draw() {
%1 = call i32 @lcd_area(i32 24, i32 0, i32 9, i32 30, i32 15)
%2 = call i32 @lcd_string(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 25, i32 1, i32 1, i32 4095, i32 15)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"SETUP\00"
define void @s_setup_root_draw() {
%1 = tail call i32 @lcd_area(i32 24, i32 0, i32 9, i32 30, i32 15)
%2 = tail call i32 @lcd_string(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 25, i32 1, i32 1, i32 4095, i32 15)
ret void
}
void test12(int x) {
  switch (x) {
  case 1:
    break;
  case 2:
    do {
    } while (0);
    break;
  }
}


x86 assembly (clang, -O0):
<test12>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     112c <test12+0x2c>
jmp    111b <test12+0x1b>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     1131 <test12+0x31>
jmp    1140 <test12+0x40>
jmp    1140 <test12+0x40>
jmp    1136 <test12+0x36>
jmp    113b <test12+0x3b>
jmp    1140 <test12+0x40>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test12(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %8 [
i32 1, label %4
i32 2, label %5
]
4: ; preds = %1
br label %8
5: ; preds = %1
br label %6
6: ; preds = %5
br label %7
7: ; preds = %6
br label %8
8: ; preds = %1, %7, %4
ret void
}

LLVM IR (-O2):
define void @test12(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ rgb_to_yuv(int /*<<< orphan*/);
int yuv_diff(int /*<<< orphan*/, int /*<<< orphan*/);
int Diff(uint32_t c1, uint32_t c2) {
  return yuv_diff(rgb_to_yuv(c1), rgb_to_yuv(c2));
}


x86 assembly (clang, -O0):
<Diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <rgb_to_yuv@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <rgb_to_yuv@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
call   1030 <yuv_diff@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Diff>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
call   1040 <rgb_to_yuv@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <rgb_to_yuv@plt>
mov    %ebp,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <yuv_diff@plt>

LLVM IR (-O0):
define i32 @Diff(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 @rgb_to_yuv(i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @rgb_to_yuv(i32 %7)
%9 = call i32 @yuv_diff(i32 %6, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @Diff(i32 %0, i32 %1) {
%3 = tail call i32 @rgb_to_yuv(i32 %0)
%4 = tail call i32 @rgb_to_yuv(i32 %1)
%5 = tail call i32 @yuv_diff(i32 %3, i32 %4)
ret i32 %5
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *leela_strndup(const char *s, size_t l) {
  char *d = (char *)malloc(l + 1);
  if (d != NULL) {
    strncpy(d, s, l);
  }
  d[l] = '\0';
  return (d);
}


x86 assembly (clang, -O0):
<leela_strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115d <leela_strndup+0x3d>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leela_strndup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x1(%rsi),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     114a <leela_strndup+0x2a>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <strncpy@plt>
movb   $0x0,(%rbx,%r14,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @leela_strndup(i8* %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @strncpy(i8* %5, i8* %0, i64 %1)
br label %9
9: ; preds = %7, %2
%10 = getelementptr inbounds i8, i8* %5, i64 %1
store i8 0, i8* %10
ret i8* %5
}
void glUniformMatrix4x3fv(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glUniformMatrix4x3fv() {
ret void
}
void __attribute__((no)) f(long long *p, int n) {
  while (--n >= 0) {
    *p = 1;
    p += 32;
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jl     113b <f+0x3b>
mov    -0x8(%rbp),%rax
movq   $0x1,(%rax)
mov    -0x8(%rbp),%rax
add    $0x100,%rax
mov    %rax,-0x8(%rbp)
jmp    110b <f+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
test   %esi,%esi
jle    11a3 <f+0xa3>
lea    -0x1(%rsi),%eax
mov    %esi,%ecx
and    $0x7,%ecx
je     1137 <f+0x37>
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movq   $0x1,(%rdi)
add    $0x100,%rdi
add    $0x1,%edx
cmp    %edx,%ecx
jne    1120 <f+0x20>
sub    %edx,%esi
cmp    $0x7,%eax
jb     11a3 <f+0xa3>
add    $0xffffffff,%esi
nop
movq   $0x1,(%rdi)
movq   $0x1,0x100(%rdi)
movq   $0x1,0x200(%rdi)
movq   $0x1,0x300(%rdi)
movq   $0x1,0x400(%rdi)
movq   $0x1,0x500(%rdi)
movq   $0x1,0x600(%rdi)
movq   $0x1,0x700(%rdi)
add    $0xfffffff8,%esi
add    $0x800,%rdi
cmp    $0xfffffffe,%esi
jb     1140 <f+0x40>
ret

LLVM IR (-O0):
define void @f(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %9, %2
%6 = load i32, i32* %4
%7 = add nsw i32 %6, -1
store i32 %7, i32* %4
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = load i64*, i64** %3
store i64 1, i64* %10
%11 = load i64*, i64** %3
%12 = getelementptr inbounds i64, i64* %11, i64 32
store i64* %12, i64** %3
br label %5
13: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @f(i64* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %34
4: ; preds = %2
%5 = add i32 %1, -1
%6 = and i32 %1, 7
%7 = icmp eq i32 %6, 0
br i1 %7, label %16, label %8
8: ; preds = %4, %8
%9 = phi i32 [ %12, %8 ], [ %1, %4 ]
%10 = phi i64* [ %13, %8 ], [ %0, %4 ]
%11 = phi i32 [ %14, %8 ], [ 0, %4 ]
%12 = add nsw i32 %9, -1
store i64 1, i64* %10
%13 = getelementptr inbounds i64, i64* %10, i64 32
%14 = add i32 %11, 1
%15 = icmp eq i32 %14, %6
br i1 %15, label %16, label %8
16: ; preds = %8, %4
%17 = phi i32 [ %1, %4 ], [ %12, %8 ]
%18 = phi i64* [ %0, %4 ], [ %13, %8 ]
%19 = icmp ult i32 %5, 7
br i1 %19, label %34, label %20
20: ; preds = %16, %20
%21 = phi i32 [ %30, %20 ], [ %17, %16 ]
%22 = phi i64* [ %31, %20 ], [ %18, %16 ]
store i64 1, i64* %22
%23 = getelementptr inbounds i64, i64* %22, i64 32
store i64 1, i64* %23
%24 = getelementptr inbounds i64, i64* %22, i64 64
store i64 1, i64* %24
%25 = getelementptr inbounds i64, i64* %22, i64 96
store i64 1, i64* %25
%26 = getelementptr inbounds i64, i64* %22, i64 128
store i64 1, i64* %26
%27 = getelementptr inbounds i64, i64* %22, i64 160
store i64 1, i64* %27
%28 = getelementptr inbounds i64, i64* %22, i64 192
store i64 1, i64* %28
%29 = getelementptr inbounds i64, i64* %22, i64 224
%30 = add nsw i32 %21, -8
store i64 1, i64* %29
%31 = getelementptr inbounds i64, i64* %22, i64 256
%32 = add i32 %21, -9
%33 = icmp ult i32 %32, -2
br i1 %33, label %20, label %34
34: ; preds = %16, %20, %2
ret void
}
void g_DUMMY_open_console(long x0, long y0, long width, long height,
                          char *title) {
  x0 = x0;
  y0 = y0;
  width = width;
  height = height;
  title = title;
}


x86 assembly (clang, -O0):
<g_DUMMY_open_console>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @g_DUMMY_open_console(i64 %0, i64 %1, i64 %2, i64 %3, i8* %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8*
store i64 %0, i64* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i8* %4, i8** %10
%11 = load i64, i64* %6
store i64 %11, i64* %6
%12 = load i64, i64* %7
store i64 %12, i64* %7
%13 = load i64, i64* %8
store i64 %13, i64* %8
%14 = load i64, i64* %9
store i64 %14, i64* %9
%15 = load i8*, i8** %10
store i8* %15, i8** %10
ret void
}

LLVM IR (-O2):
define void @g_DUMMY_open_console(i64 %0, i64 %1, i64 %2, i64 %3, i8* nocapture %4) {
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t trim_value(uint64_t value, int length) {
  if (length < 64) {
    value &= (((uint64_t)1 << length) - 1);
  }
  return value;
}


x86 assembly (clang, -O0):
<trim_value>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x40,-0x8(%rbp)
jge    1127 <trim_value+0x27>
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim_value>:
mov    %esi,%ecx
mov    $0xffffffff,%edx
mov    $0xffffffff,%eax
shl    %cl,%eax
cmp    $0x40,%esi
not    %eax
cmovge %edx,%eax
and    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @trim_value(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 64
%4 = shl nsw i32 -1, %1
%5 = xor i32 %4, -1
%6 = select i1 %3, i32 %5, i32 -1
%7 = and i32 %6, %0
ret i32 %7
}
void BUG(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<BUG>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <BUG+0x9>
jmp    1109 <BUG+0x9>

x86 assembly (clang, -O2):
<BUG>:
jmp    1100 <BUG>

LLVM IR (-O0):
define void @BUG() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @BUG() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void vec_status(void) {
  printf("Vector math: ");
  printf("SSE2\n");
}


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

x86 assembly (clang, -O2):
<vec_status>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xeda(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Vector math: \00"
@.str.1 = [6 x i8] c"SSE2\0A\00"
define void @vec_status() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"Vector math: \00"
@str = [5 x i8] c"SSE2\00"
define void @vec_status() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int write(int, unsigned char *, int);
int putchar(int ch) {
  unsigned char c = ch;
  return write(1, &c, 1);
}


x86 assembly (clang, -O0):
<putchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x5(%rbp)
mov    $0x1,%edx
lea    -0x5(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putchar>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @putchar(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = trunc i32 %4 to i8
store i8 %5, i8* %3
%6 = call i32 @write(i32 1, i8* %3, i32 1)
ret i32 %6
}

LLVM IR (-O2):
define i32 @putchar(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = call i32 @write(i32 1, i8* %2, i32 1)
ret i32 %4
}
/* Variables and functions */
double __ocml_fmax_f64(double, double);
double fmax(double x, double y) { return __ocml_fmax_f64(x, y); }


x86 assembly (clang, -O0):
<fmax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <__ocml_fmax_f64@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmax>:
jmp    1030 <__ocml_fmax_f64@plt>

LLVM IR (-O0):
define double @fmax(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @__ocml_fmax_f64(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @fmax(double %0, double %1) {
%3 = tail call double @__ocml_fmax_f64(double %0, double %1)
ret double %3
}
void compute(int count) {
  long i;
  volatile long junk;
  junk = 0;
  for (i = 0; i < count * 1000000; i++) {
    junk++;
  }
}


x86 assembly (clang, -O0):
<compute>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
imul   $0xf4240,-0x4(%rbp),%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jge    114b <compute+0x4b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1117 <compute+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute>:
movq   $0x0,-0x8(%rsp)
test   %edi,%edi
jle    117c <compute+0x7c>
imul   $0xf4240,%edi,%eax
cmp    $0x2,%eax
mov    $0x1,%ecx
cmovge %eax,%ecx
lea    -0x1(%rcx),%rdx
mov    %ecx,%eax
and    $0x1,%eax
cmp    $0x3,%rdx
jb     115e <compute+0x5e>
and    $0x7fffffc0,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
addq   $0x1,-0x8(%rsp)
addq   $0x1,-0x8(%rsp)
addq   $0x1,-0x8(%rsp)
addq   $0x1,-0x8(%rsp)
add    $0xfffffffffffffffc,%rcx
jne    1140 <compute+0x40>
test   %rax,%rax
je     117c <compute+0x7c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
addq   $0x1,-0x8(%rsp)
add    $0xffffffffffffffff,%rax
jne    1170 <compute+0x70>
ret

LLVM IR (-O0):
define void @compute(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i32 %0, i32* %2
store volatile i64 0, i64* %4
store i64 0, i64* %3
br label %5
5: ; preds = %14, %1
%6 = load i64, i64* %3
%7 = load i32, i32* %2
%8 = mul nsw i32 %7, 1000000
%9 = sext i32 %8 to i64
%10 = icmp slt i64 %6, %9
br i1 %10, label %11, label %17
11: ; preds = %5
%12 = load volatile i64, i64* %4
%13 = add nsw i64 %12, 1
store volatile i64 %13, i64* %4
br label %14
14: ; preds = %11
%15 = load i64, i64* %3
%16 = add nsw i64 %15, 1
store i64 %16, i64* %3
br label %5
17: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @compute(i32 %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
store volatile i64 0, i64* %2
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %34
5: ; preds = %1
%6 = mul nsw i32 %0, 1000000
%7 = call i32 @llvm.smax.i32(i32 %6, i32 1)
%8 = zext i32 %7 to i64
%9 = add nsw i64 %8, -1
%10 = and i64 %8, 1
%11 = icmp ult i64 %9, 3
br i1 %11, label %26, label %12
12: ; preds = %5
%13 = and i64 %8, 2147483584
br label %14
14: ; preds = %14, %12
%15 = phi i64 [ 0, %12 ], [ %24, %14 ]
%16 = load volatile i64, i64* %2
%17 = add nsw i64 %16, 1
store volatile i64 %17, i64* %2
%18 = load volatile i64, i64* %2
%19 = add nsw i64 %18, 1
store volatile i64 %19, i64* %2
%20 = load volatile i64, i64* %2
%21 = add nsw i64 %20, 1
store volatile i64 %21, i64* %2
%22 = load volatile i64, i64* %2
%23 = add nsw i64 %22, 1
store volatile i64 %23, i64* %2
%24 = add i64 %15, 4
%25 = icmp eq i64 %24, %13
br i1 %25, label %26, label %14
26: ; preds = %14, %5
%27 = icmp eq i64 %10, 0
br i1 %27, label %34, label %28
28: ; preds = %26, %28
%29 = phi i64 [ %32, %28 ], [ 0, %26 ]
%30 = load volatile i64, i64* %2
%31 = add nsw i64 %30, 1
store volatile i64 %31, i64* %2
%32 = add i64 %29, 1
%33 = icmp eq i64 %32, %10
br i1 %33, label %34, label %28
34: ; preds = %26, %28, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void DMA1_Stream6_IRQHandler() { default_handler(); }


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

x86 assembly (clang, -O2):
<DMA1_Stream6_IRQHandler>:
xor    %eax,%eax
jmp    1030 <default_handler@plt>

LLVM IR (-O0):
define weak void @DMA1_Stream6_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @DMA1_Stream6_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void sss(char *s) { printf("inside of sss %s\n", s); }


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

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

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

LLVM IR (-O2):
@.str = [18 x i8] c"inside of sss %s\0A\00"
define void @sss(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int tolower(int c) {
  unsigned char cb = c;
  if ((cb >= 'A') && (cb <= 'Z'))
    cb ^= 0x20;
  return cb;
}


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1131 <tolower+0x31>
movzbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1131 <tolower+0x31>
movzbl -0x5(%rbp),%eax
xor    $0x20,%eax
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
movzbl %dil,%eax
add    $0xffffffbf,%eax
mov    %edi,%ecx
xor    $0x20,%ecx
cmp    $0x1a,%eax
cmovae %edi,%ecx
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @tolower(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = trunc i32 %4 to i8
store i8 %5, i8* %3
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = icmp sge i32 %7, 65
br i1 %8, label %9, label %18
9: ; preds = %1
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = icmp sle i32 %11, 90
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = xor i32 %15, 32
%17 = trunc i32 %16 to i8
store i8 %17, i8* %3
br label %18
18: ; preds = %13, %9, %1
%19 = load i8, i8* %3
%20 = zext i8 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = and i32 %0, 255
%3 = add nsw i32 %2, -65
%4 = icmp ult i32 %3, 26
%5 = xor i32 %0, 32
%6 = select i1 %4, i32 %5, i32 %0
%7 = and i32 %6, 255
ret i32 %7
}
/* Variables and functions */
float sqrtf(float);
float __attribute__((always_)) fast_sqrtf(float x) { return sqrtf(x); }


x86 assembly (clang, -O0):
<fast_sqrtf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sqrtf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fast_sqrtf>:
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     111d <fast_sqrtf+0xd>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrtf@plt>

LLVM IR (-O0):
define float @fast_sqrtf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @sqrtf(float %3)
ret float %4
}

LLVM IR (-O2):
define float @fast_sqrtf(float %0) {
%2 = tail call float @sqrtf(float %0)
ret float %2
}
/* Variables and functions */
int f();
int f2(int /*<<< orphan*/);
int f3();
int main() {
  int x;
  x = f2(0);
  x = f();
  int z;
  z = f3();
  if (z != x) {
  ERROR:
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <f2@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <f@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <f3@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     117a <main+0x4a>
jmp    116e <main+0x3e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1181 <main+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1030 <f2@plt>
xor    %eax,%eax
call   1040 <f@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <f3@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
setne  %cl
neg    %ecx
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f2(i32 0)
%2 = tail call i32 (...) @f()
%3 = tail call i32 (...) @f3()
%4 = icmp ne i32 %3, %2
%5 = sext i1 %4 to i32
ret i32 %5
}
int addr2sector(void *p) { return (int)p; }


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

x86 assembly (clang, -O2):
<addr2sector>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i32 @addr2sector(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
ret i32 %3
}
int apply(int (*f)(int), int arg) { return f(arg); }


x86 assembly (clang, -O0):
<apply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%edi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<apply>:
mov    %rdi,%rax
mov    %esi,%edi
jmp    *%rax

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

LLVM IR (-O2):
define i32 @apply(i32 (i32)* nocapture %0, i32 %1) {
%3 = tail call i32 %0(i32 %1)
ret i32 %3
}
void predefString_doesNothing(struct private_stringStruct *this) {}


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

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

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

LLVM IR (-O2):
%struct.private_stringStruct = type opaque
define void @predefString_doesNothing(%struct.private_stringStruct* nocapture %0) {
ret void
}
/* Type definitions */
struct list_entry {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct list_entry *);
void __list_entry_term(struct list_entry *entry) { free(entry); }


x86 assembly (clang, -O0):
<__list_entry_term>:
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):
<__list_entry_term>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.list_entry = type { i32 }
define void @__list_entry_term(%struct.list_entry* %0) {
%2 = alloca %struct.list_entry*
store %struct.list_entry* %0, %struct.list_entry** %2
%3 = load %struct.list_entry*, %struct.list_entry** %2
%4 = call i32 @free(%struct.list_entry* %3)
ret void
}

LLVM IR (-O2):
%struct.list_entry = type { i32 }
define void @__list_entry_term(%struct.list_entry* nocapture %0) {
%2 = tail call i32 @free(%struct.list_entry* %0)
ret void
}
int handle_op(char *buf) {}


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

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

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

LLVM IR (-O2):
define i32 @handle_op(i8* nocapture readnone %0) {
ret i32 undef
}
void SockDestory() { ; }


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

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

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

LLVM IR (-O2):
define void @SockDestory() {
ret void
}
/* Type definitions */
typedef int __v4si;
typedef scalar_t__ __m128d;

/* Variables and functions */
__m128d __attribute__((__always___, __nodebug__))
_mm_and_pd(__m128d a, __m128d b) {
  return (__m128d)((__v4si)a & (__v4si)b);
}


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

x86 assembly (clang, -O2):
<_mm_and_pd>:
and    %edi,%esi
movslq %esi,%rax
ret

LLVM IR (-O0):
define i64 @_mm_and_pd(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 = trunc i64 %5 to i32
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = and i32 %6, %8
%10 = sext i32 %9 to i64
ret i64 %10
}

LLVM IR (-O2):
define i64 @_mm_and_pd(i64 %0, i64 %1) {
%3 = and i64 %1, %0
%4 = shl i64 %3, 32
%5 = ashr exact i64 %4, 32
ret i64 %5
}
/* Variables and functions */
int loaderGetInt(char *);
int loaderGetShort(char *);
int loaderSizeBC(char *src) {
  int n, b;
  n = loaderGetInt(src);
  src += n;
  b = loaderGetInt(src);
  src += 4 + b;
  n += 4 + b;
  n += 2 + (loaderGetShort(src) << 2);
  return n;
}


x86 assembly (clang, -O0):
<loaderSizeBC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <loaderGetInt@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <loaderGetInt@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
add    $0x4,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x4,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <loaderGetShort@plt>
shl    $0x2,%eax
add    $0x2,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loaderSizeBC>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <loaderGetInt@plt>
movslq %eax,%r14
add    %r14,%rbx
mov    %rbx,%rdi
call   1030 <loaderGetInt@plt>
add    %eax,%r14d
cltq
lea    (%rax,%rbx,1),%rdi
add    $0x4,%rdi
call   1040 <loaderGetShort@plt>
lea    (%r14,%rax,4),%eax
add    $0x6,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @loaderSizeBC(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @loaderGetInt(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = load i8*, i8** %2
%9 = sext i32 %7 to i64
%10 = getelementptr inbounds i8, i8* %8, i64 %9
store i8* %10, i8** %2
%11 = load i8*, i8** %2
%12 = call i32 @loaderGetInt(i8* %11)
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = add nsw i32 4, %13
%15 = load i8*, i8** %2
%16 = sext i32 %14 to i64
%17 = getelementptr inbounds i8, i8* %15, i64 %16
store i8* %17, i8** %2
%18 = load i32, i32* %4
%19 = add nsw i32 4, %18
%20 = load i32, i32* %3
%21 = add nsw i32 %20, %19
store i32 %21, i32* %3
%22 = load i8*, i8** %2
%23 = call i32 @loaderGetShort(i8* %22)
%24 = shl i32 %23, 2
%25 = add nsw i32 2, %24
%26 = load i32, i32* %3
%27 = add nsw i32 %26, %25
store i32 %27, i32* %3
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @loaderSizeBC(i8* %0) {
%2 = tail call i32 @loaderGetInt(i8* %0)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = tail call i32 @loaderGetInt(i8* %4)
%6 = add nsw i32 %5, 4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %4, i64 %7
%9 = tail call i32 @loaderGetShort(i8* %8)
%10 = shl i32 %9, 2
%11 = add i32 %2, 2
%12 = add i32 %11, %6
%13 = add i32 %12, %10
ret i32 %13
}
void bac(int a, int b) {}


x86 assembly (clang, -O0):
<bac>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @bac(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @bac(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;

/* Variables and functions */
int isdigit(int /*<<< orphan*/);
int iswdigit(wint_t c) { return isdigit(c); }


x86 assembly (clang, -O0):
<iswdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isdigit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iswdigit>:
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @iswdigit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
void foo(void) { __asm__ __volatile__("" : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @foo() {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void usage(FILE *fp, int argc, char **argv) {
  fprintf(fp,
          "Usage: %s [options]\n\n"
          "Options:\n"
          "-d | --device name   Video device name [/dev/video0]\n"
          "-h | --help          Print this message\n"
          "-m | --mmap          Use memory mapped buffers [default]\n"
          "-r | --read          Use read() calls\n"
          "-u | --userp         Use application allocated buffers\n"
          "",
          argv[0]);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xecb(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    (%rdx),%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [274 x i8] c"Usage: %s [options]\0A\0AOptions:\0A-d | --device name Video device name [/dev/video0]\0A-h | --help Print this message\0A-m | --mmap Use memory mapped buffers [default]\0A-r | --read Use read() calls\0A-u | --userp Use application allocated buffers\0A\00"
define void @usage(i32* %0, i32 %1, i8** %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8**
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%7 = load i32*, i32** %4
%8 = load i8**, i8*** %6
%9 = getelementptr inbounds i8*, i8** %8, i64 0
%10 = load i8*, i8** %9
%11 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([274 x i8], [274 x i8]* @.str, i64 0, i64 0), i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [274 x i8] c"Usage: %s [options]\0A\0AOptions:\0A-d | --device name Video device name [/dev/video0]\0A-h | --help Print this message\0A-m | --mmap Use memory mapped buffers [default]\0A-r | --read Use read() calls\0A-u | --userp Use application allocated buffers\0A\00"
define void @usage(i32* nocapture %0, i32 %1, i8** nocapture %2) {
%4 = load i8*, i8** %2
%5 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([274 x i8], [274 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}