xunge/DecIR huggingface dataset:
/* Variables and functions */
void *malloc(size_t);
void *memcpy(void *, void const *, size_t);
void *memdup(const void *src, size_t sz) {
  void *mem = malloc(sz);
  return mem ? memcpy(mem, src, sz) : NULL;
}


x86 assembly (clang, -O0):
<memdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116a <memdup+0x4a>
mov    -0x18(%rbp),%rdi
mov    %rdi,-0x28(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1175 <memdup+0x55>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    1175 <memdup+0x55>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memdup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1149 <memdup+0x29>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @memdup(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 = call i8* @malloc(i64 %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = load i8*, i8** %3
%13 = load i64, i64* %4
br label %15
14: ; preds = %2
br label %15
15: ; preds = %14, %10
%16 = phi i8* [ %11, %10 ], [ null, %14 ]
ret i8* %16
}

LLVM IR (-O2):
define noalias i8* @memdup(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @malloc(i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %3, i8* align 1 %0, i64 %1, i1 false)
br label %6
6: ; preds = %2, %5
ret i8* %3
}
int test_imm_FFint8_reg(signed char val) {
  return ((val) & (0xFF << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_FFint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xff,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_FFint8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 255
%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_FFint8_reg(i8 signext %0) {
%2 = icmp eq i8 %0, 0
%3 = select i1 %2, i32 -40, i32 -20
ret i32 %3
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
char *webp_js(char *content, int size) {
  const char _webp_header[18] = {0x52, 0x49, 0x46, 0x46, 0x2f, 0x2a,
                                 0x00, 0x00, 0x57, 0x45, 0x42, 0x50,
                                 0x2a, 0x2f, 0x3d, 0x30, 0x3b, 0x0a};
  char *buffer = (char *)malloc(18 + size);
  memcpy(buffer, _webp_header, 18);
  memcpy(&buffer[18], content, size);
  return buffer;
}


x86 assembly (clang, -O0):
<webp_js>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%ax
mov    %ax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
add    $0x12,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x12,%edx
call   1030 <memcpy@plt>
mov    -0x28(%rbp),%rdi
add    $0x12,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<webp_js>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %esi,%r15d
mov    %rdi,%r14
movaps 0xeca(%rip),%xmm0
movaps %xmm0,(%rsp)
movw   $0xa3b,0x10(%rsp)
lea    0x12(%r15),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rsp,%rsi
mov    %rax,%rdi
mov    $0x12,%edx
call   1030 <memcpy@plt>
lea    0x12(%rbx),%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.webp_js._webp_header = [18 x i8] c"RIFF/*\00\00WEBP*/=0;\0A"
define i8* @webp_js(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [18 x i8]
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = bitcast [18 x i8]* %5 to i8*
%8 = load i32, i32* %4
%9 = add nsw i32 18, %8
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%14 = call i32 @memcpy(i8* %12, i8* %13, i32 18)
%15 = load i8*, i8** %6
%16 = getelementptr inbounds i8, i8* %15, i64 18
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = call i32 @memcpy(i8* %16, i8* %17, i32 %18)
%20 = load i8*, i8** %6
ret i8* %20
}

LLVM IR (-O2):
@__const.webp_js._webp_header = [18 x i8] c"RIFF/*\00\00WEBP*/=0;\0A"
define i8* @webp_js(i8* %0, i32 %1) {
%3 = alloca [18 x i8]
%4 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%5 = add nsw i32 %1, 18
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = call i32 @memcpy(i8* %7, i8* %4, i32 18)
%9 = getelementptr inbounds i8, i8* %7, i64 18
%10 = call i32 @memcpy(i8* %9, i8* %0, i32 %1)
ret i8* %7
}
int shadem_(m)
int *m;
{}


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

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

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

LLVM IR (-O2):
define i32 @shadem_(i32* nocapture readnone %0) {
ret i32 undef
}
/* Variables and functions */
scalar_t__ g2_ld();
float g2_ld_(void) { return (float)g2_ld(); }


x86 assembly (clang, -O0):
<g2_ld_>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <g2_ld@plt>
cvtsi2ss %rax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<g2_ld_>:
push   %rax
xor    %eax,%eax
call   1030 <g2_ld@plt>
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @g2_ld_() {
%1 = call i64 (...) @g2_ld()
%2 = sitofp i64 %1 to float
ret float %2
}

LLVM IR (-O2):
define float @g2_ld_() {
%1 = tail call i64 (...) @g2_ld()
%2 = sitofp i64 %1 to float
ret float %2
}
/* Variables and functions */
double fabs(double);
double sign(double a, double b) { return (b > 0.0) ? fabs(a) : -fabs(a); }


x86 assembly (clang, -O0):
<sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    113a <sign+0x3a>
movsd  -0x8(%rbp),%xmm0
movaps 0xed4(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1166 <sign+0x66>
movsd  -0x8(%rbp),%xmm0
movaps 0xeba(%rip),%xmm1
pand   %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign>:
movapd 0xef8(%rip),%xmm3
andpd  %xmm0,%xmm3
orpd   0xefc(%rip),%xmm0
xorpd  %xmm2,%xmm2
cmpltsd %xmm1,%xmm2
andpd  %xmm2,%xmm3
andnpd %xmm0,%xmm2
orpd   %xmm3,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @sign(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fcmp ogt double %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load double, double* %3
%9 = call double @llvm.fabs.f64(double %8)
br label %14
10: ; preds = %2
%11 = load double, double* %3
%12 = call double @llvm.fabs.f64(double %11)
%13 = fneg double %12
br label %14
14: ; preds = %10, %7
%15 = phi double [ %9, %7 ], [ %13, %10 ]
ret double %15
}

LLVM IR (-O2):
define double @sign(double %0, double %1) {
%3 = fcmp ogt double %1, 0.000000e+00
%4 = tail call double @llvm.fabs.f64(double %0)
%5 = fneg double %4
%6 = select i1 %3, double %4, double %5
ret double %6
}
/* Variables and functions */
int Get_Word();
int Get_Long() {
  int i;
  i = Get_Word();
  return (i << 16) | Get_Word();
}


x86 assembly (clang, -O0):
<Get_Long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <Get_Word@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x10,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <Get_Word@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_Long>:
push   %rbx
xor    %eax,%eax
call   1030 <Get_Word@plt>
mov    %eax,%ebx
shl    $0x10,%ebx
xor    %eax,%eax
call   1030 <Get_Word@plt>
or     %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @Get_Long() {
%1 = alloca i32
%2 = call i32 (...) @Get_Word()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = shl i32 %3, 16
%5 = call i32 (...) @Get_Word()
%6 = or i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @Get_Long() {
%1 = tail call i32 (...) @Get_Word()
%2 = shl i32 %1, 16
%3 = tail call i32 (...) @Get_Word()
%4 = or i32 %2, %3
ret i32 %4
}
unsigned long ROL64(unsigned long word, int i) {
  asm("rolq %%cl, %0" : "=r"(word) : "0"(word), "c"(i));
  return word;
}


x86 assembly (clang, -O0):
<ROL64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
rol    %cl,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ROL64>:
mov    %esi,%ecx
mov    %rdi,%rax
rol    %cl,%rax
ret

LLVM IR (-O0):
define i64 @ROL64(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = call i64 asm "rolq %cl, $0", "=r,0,{cx},~{dirflag},~{fpsr},~{flags}"(i64 %5, i32 %6)
store i64 %7, i64* %3
%8 = load i64, i64* %3
ret i64 %8
}

LLVM IR (-O2):
define i64 @ROL64(i64 %0, i32 %1) {
%3 = tail call i64 asm "rolq %cl, $0", "=r,0,{cx},~{dirflag},~{fpsr},~{flags}"(i64 %0, i32 %1)
ret i64 %3
}
/* Variables and functions */
int fun(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d", fun(100001));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x186a1,%edi
call   1030 <fun@plt>
mov    %eax,%esi
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @fun(i32 100001)
%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"
define i32 @main() {
%1 = tail call i32 @fun(i32 100001)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(int);
char *new_string(int size) {
  char *str = (char *)malloc(sizeof(char) * size);
  return str;
}


x86 assembly (clang, -O0):
<new_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_string>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @new_string(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = mul i64 1, %5
%7 = trunc i64 %6 to i32
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %3
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
define i8* @new_string(i32 %0) {
%2 = tail call i64 @malloc(i32 %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) { printf("Hello\n"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%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>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [6 x i8] c"Hello\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
scalar_t__ wcsncpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *, size_t);
int wcsncpy_s(wchar_t *str, size_t size, const wchar_t *src, size_t len) {
  return wcsncpy(str, src, ((size) < (len) ? (size) : (len))) ? 0 : -1;
}


x86 assembly (clang, -O0):
<wcsncpy_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1153 <wcsncpy_s+0x43>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    115b <wcsncpy_s+0x4b>
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rdx
call   1030 <wcsncpy@plt>
mov    %rax,%rdx
mov    $0xffffffff,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsncpy_s>:
push   %rax
cmp    %rcx,%rsi
cmovb  %rsi,%rcx
mov    %rdx,%rsi
mov    %rcx,%rdx
call   1030 <wcsncpy@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @wcsncpy_s(i32* %0, i64 %1, i32* %2, i64 %3) {
%5 = icmp ult i64 %1, %3
%6 = select i1 %5, i64 %1, i64 %3
%7 = tail call i64 @wcsncpy(i32* %0, i32* %2, i64 %6)
%8 = icmp eq i64 %7, 0
%9 = sext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void erase() { putchar('e'); }


x86 assembly (clang, -O0):
<erase>:
push   %rbp
mov    %rsp,%rbp
mov    $0x65,%edi
call   1030 <putchar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<erase>:
mov    $0x65,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @erase() {
%1 = call i32 @putchar(i8 signext 101)
ret void
}

LLVM IR (-O2):
define void @erase() {
%1 = tail call i32 @putchar(i8 signext 101)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ pthread_self();
int /*<<< orphan*/ sleep(int);
void *thread(void *vargp) {
  sleep(3);
  printf("Hello world!\n");
  printf("thread tid = %lu\n", pthread_self());
  return NULL;
}


x86 assembly (clang, -O0):
<thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x3,%edi
call   1050 <sleep@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread>:
push   %rax
mov    $0x3,%edi
call   1060 <sleep@plt>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <pthread_self@plt>
lea    0xe9b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
@.str.1 = [18 x i8] c"thread tid = %lu\0A\00"
define i8* @thread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @sleep(i32 3)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @pthread_self()
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i8* null
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"thread tid = %lu\0A\00"
@str = [13 x i8] c"Hello world!\00"
define noalias i8* @thread(i8* nocapture readnone %0) {
%2 = tail call i32 @sleep(i32 3)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @pthread_self()
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i8* null
}
int f(float f, double d) {
  float f1 = d;
  double d1 = f;
  f1 = d + f;
  return 2;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    $0x2,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f(float %0, double %1) {
%3 = alloca float
%4 = alloca double
%5 = alloca float
%6 = alloca double
store float %0, float* %3
store double %1, double* %4
%7 = load double, double* %4
%8 = fptrunc double %7 to float
store float %8, float* %5
%9 = load float, float* %3
%10 = fpext float %9 to double
store double %10, double* %6
%11 = load double, double* %4
%12 = load float, float* %3
%13 = fpext float %12 to double
%14 = fadd double %11, %13
%15 = fptrunc double %14 to float
store float %15, float* %5
ret i32 2
}

LLVM IR (-O2):
define i32 @f(float %0, double %1) {
ret i32 2
}
void load_terminfo_keys() {}


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

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

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

LLVM IR (-O2):
define void @load_terminfo_keys() {
ret void
}
/* Variables and functions */
int O_CREAT;
int O_TRUNC;
int wr_test(char const *, int, int, int, int);
int test_wr_trunc(const char *file) {
  return wr_test(file, 16, 26, O_CREAT | O_TRUNC, 0777);
}


x86 assembly (clang, -O0):
<test_wr_trunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ed1(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec0(%rip),%rax
or     (%rax),%ecx
mov    $0x10,%esi
mov    $0x1a,%edx
mov    $0x1ff,%r8d
call   1030 <wr_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_wr_trunc>:
mov    0x2ee1(%rip),%rax
mov    0x2ed2(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    $0x10,%esi
mov    $0x1a,%edx
mov    $0x1ff,%r8d
jmp    1030 <wr_test@plt>

LLVM IR (-O0):
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
define i32 @test_wr_trunc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @O_CREAT
%5 = load i32, i32* @O_TRUNC
%6 = or i32 %4, %5
%7 = call i32 @wr_test(i8* %3, i32 16, i32 26, i32 %6, i32 511)
ret i32 %7
}

LLVM IR (-O2):
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
define i32 @test_wr_trunc(i8* %0) {
%2 = load i32, i32* @O_CREAT
%3 = load i32, i32* @O_TRUNC
%4 = or i32 %3, %2
%5 = tail call i32 @wr_test(i8* %0, i32 16, i32 26, i32 %4, i32 511)
ret i32 %5
}
/* Type definitions */
typedef char uint8_t;

/* Variables and functions */
void retx_init(uint8_t *p_retx) {
  p_retx[0] = 'R';
  p_retx[1] = 'E';
  p_retx[2] = 'T';
  p_retx[3] = 'X';
}


x86 assembly (clang, -O0):
<retx_init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x52,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x45,0x1(%rax)
mov    -0x8(%rbp),%rax
movb   $0x54,0x2(%rax)
mov    -0x8(%rbp),%rax
movb   $0x58,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<retx_init>:
movl   $0x58544552,(%rdi)
ret

LLVM IR (-O0):
define void @retx_init(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
store i8 82, i8* %4
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 1
store i8 69, i8* %6
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 2
store i8 84, i8* %8
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 3
store i8 88, i8* %10
ret void
}

LLVM IR (-O2):
define void @retx_init(i8* nocapture writeonly %0) {
store i8 82, i8* %0
%2 = getelementptr inbounds i8, i8* %0, i64 1
store i8 69, i8* %2
%3 = getelementptr inbounds i8, i8* %0, i64 2
store i8 84, i8* %3
%4 = getelementptr inbounds i8, i8* %0, i64 3
store i8 88, i8* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __cpuid_count(int, int /*<<< orphan*/, int, int, int, int);
void cpuid(int info[4], int InfoType) {
  __cpuid_count(InfoType, 0, info[0], info[1], info[2], info[3]);
}


x86 assembly (clang, -O0):
<cpuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%r9d
xor    %esi,%esi
call   1030 <__cpuid_count@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid>:
mov    (%rdi),%edx
mov    0x4(%rdi),%ecx
mov    0x8(%rdi),%r8d
mov    0xc(%rdi),%r9d
mov    %esi,%edi
xor    %esi,%esi
jmp    1030 <__cpuid_count@plt>

LLVM IR (-O0):
define void @cpuid(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 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32, i32* %10
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 3
%17 = load i32, i32* %16
%18 = call i32 @__cpuid_count(i32 %5, i32 0, i32 %8, i32 %11, i32 %14, i32 %17)
ret void
}

LLVM IR (-O2):
define void @cpuid(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = getelementptr inbounds i32, i32* %0, i64 2
%7 = load i32, i32* %6
%8 = getelementptr inbounds i32, i32* %0, i64 3
%9 = load i32, i32* %8
%10 = tail call i32 @__cpuid_count(i32 %1, i32 0, i32 %3, i32 %5, i32 %7, i32 %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
void _sys_send(int sock, char *message) {
  send(sock, message, strlen(message), 0);
}


x86 assembly (clang, -O0):
<_sys_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_sys_send>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <send@plt>

LLVM IR (-O0):
define void @_sys_send(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @send(i32 %5, i8* %6, i32 %8, i32 0)
ret void
}

LLVM IR (-O2):
define void @_sys_send(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @send(i32 %0, i8* %1, i32 %3, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test2D();
int /*<<< orphan*/ testArgs();
int /*<<< orphan*/ testDecay();
int /*<<< orphan*/ testGlobalChar();
int /*<<< orphan*/ testGlobalDouble();
int /*<<< orphan*/ testLocalDouble();
int /*<<< orphan*/ testLocalInt();
int main() {
  testLocalInt();
  testLocalDouble();
  testGlobalChar();
  testGlobalDouble();
  testArgs();
  testDecay();
  test2D();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <testLocalInt@plt>
mov    $0x0,%al
call   1090 <testLocalDouble@plt>
mov    $0x0,%al
call   1030 <testGlobalChar@plt>
mov    $0x0,%al
call   1070 <testGlobalDouble@plt>
mov    $0x0,%al
call   1040 <testArgs@plt>
mov    $0x0,%al
call   1060 <testDecay@plt>
mov    $0x0,%al
call   1080 <test2D@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <testLocalInt@plt>
xor    %eax,%eax
call   1090 <testLocalDouble@plt>
xor    %eax,%eax
call   1030 <testGlobalChar@plt>
xor    %eax,%eax
call   1070 <testGlobalDouble@plt>
xor    %eax,%eax
call   1040 <testArgs@plt>
xor    %eax,%eax
call   1060 <testDecay@plt>
xor    %eax,%eax
call   1080 <test2D@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @testLocalInt()
%3 = call i32 (...) @testLocalDouble()
%4 = call i32 (...) @testGlobalChar()
%5 = call i32 (...) @testGlobalDouble()
%6 = call i32 (...) @testArgs()
%7 = call i32 (...) @testDecay()
%8 = call i32 (...) @test2D()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @testLocalInt()
%2 = tail call i32 (...) @testLocalDouble()
%3 = tail call i32 (...) @testGlobalChar()
%4 = tail call i32 (...) @testGlobalDouble()
%5 = tail call i32 (...) @testArgs()
%6 = tail call i32 (...) @testDecay()
%7 = tail call i32 (...) @test2D()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ phantom_thread_switch();
void phantom_scheduler_request_soft_irq() { phantom_thread_switch(); }


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

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

LLVM IR (-O0):
define void @phantom_scheduler_request_soft_irq() {
%1 = call i32 (...) @phantom_thread_switch()
ret void
}

LLVM IR (-O2):
define void @phantom_scheduler_request_soft_irq() {
%1 = tail call i32 (...) @phantom_thread_switch()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ count(int /*<<< orphan*/, void *);
void counts(const char *c, void *p) {
  while (*c)
    count(*c++, p);
}


x86 assembly (clang, -O0):
<counts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114d <counts+0x3d>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1030 <count@plt>
jmp    1120 <counts+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<counts>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1146 <counts+0x36>
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%edi
mov    %r14,%rsi
call   1030 <count@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <counts+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @counts(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %9, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %3
%12 = load i8, i8* %10
%13 = sext i8 %12 to i32
%14 = load i8*, i8** %4
%15 = call i32 @count(i32 %13, i8* %14)
br label %5
16: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @counts(i8* nocapture %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %8, %5 ], [ %0, %2 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = sext i8 %6 to i32
%10 = tail call i32 @count(i32 %9, i8* %1)
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
ret void
}
RX0AR1(r0, r1, x0, x1, p0, p1) unsigned short r0, r1;
unsigned short *p0, *p1;
{
  if ((p0[x0]) <= (p1[1111111 / 4]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<RX0AR1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzwl (%rax,%rcx,2),%eax
mov    -0x20(%rbp),%rcx
movzwl 0x87a22(%rcx),%ecx
cmp    %ecx,%eax
jg     114a <RX0AR1+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1151 <RX0AR1+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RX0AR1>:
movslq %edx,%rax
movzwl (%r8,%rax,2),%ecx
xor    %eax,%eax
cmp    0x87a22(%r9),%cx
setbe  %al
ret

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

LLVM IR (-O2):
define i32 @RX0AR1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture %4, i16* nocapture %5) {
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i16, i16* %4, i64 %7
%9 = load i16, i16* %8
%10 = getelementptr inbounds i16, i16* %5, i64 277777
%11 = load i16, i16* %10
%12 = icmp ule i16 %9, %11
%13 = zext i1 %12 to i32
ret i32 %13
}
char *toUppercase(char *src) {
  char *p;
  p = src;
  while (*p != '\0') {
    if (*p >= 'a' && *p <= 'z') {
      *p -= 32;
    }
    p++;
  }
  return src;
}


x86 assembly (clang, -O0):
<toUppercase>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115d <toUppercase+0x5d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     114c <toUppercase+0x4c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     114c <toUppercase+0x4c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
sub    $0x20,%ecx
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <toUppercase+0x10>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toUppercase>:
mov    %rdi,%rax
mov    (%rdi),%cl
test   %cl,%cl
je     112c <toUppercase+0x2c>
lea    0x1(%rax),%rdx
jmp    111b <toUppercase+0x1b>
nop
movzbl (%rdx),%ecx
add    $0x1,%rdx
test   %cl,%cl
je     112c <toUppercase+0x2c>
lea    -0x61(%rcx),%esi
cmp    $0x19,%sil
ja     1110 <toUppercase+0x10>
add    $0xe0,%cl
mov    %cl,-0x1(%rdx)
jmp    1110 <toUppercase+0x10>
ret

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

LLVM IR (-O2):
define i8* @toUppercase(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %11
%5 = phi i8 [ %13, %11 ], [ %2, %1 ]
%6 = phi i8* [ %12, %11 ], [ %0, %1 ]
%7 = add i8 %5, -97
%8 = icmp ult i8 %7, 26
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = add nsw i8 %5, -32
store i8 %10, i8* %6
br label %11
11: ; preds = %9, %4
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %11, %1
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
void print_utf32(unsigned int *utf32str) {
  int i;
  for (i = 0; utf32str[i]; i++)
    printf(" %X", utf32str[i]);
}


x86 assembly (clang, -O0):
<print_utf32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     115a <print_utf32+0x4a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print_utf32+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_utf32>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%esi
test   %esi,%esi
je     1142 <print_utf32+0x32>
mov    %rdi,%rbx
add    $0x4,%rbx
lea    0xed8(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%rbx),%esi
add    $0x4,%rbx
test   %esi,%esi
jne    1130 <print_utf32+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c" %X\00"
define void @print_utf32(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
br label %4
4: ; preds = %18, %1
%5 = load i32*, i32** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %4
%12 = load i32*, i32** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %11
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %4
21: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c" %X\00"
define void @print_utf32(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i32 [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
int f(register unsigned m, register long n) {
  register int i = 10;
  static int ij = 10;
  int sum = (m + n + i + ij);
  ij = ij + 900;
  return sum;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
movslq 0x2ef9(%rip),%rcx
add    %rcx,%rax
mov    %eax,-0x18(%rbp)
mov    0x2eed(%rip),%eax
add    $0x384,%eax
mov    %eax,0x2ee2(%rip)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    0x2f1a(%rip),%ecx
add    %edi,%esi
lea    (%rcx,%rsi,1),%eax
add    $0xa,%eax
add    $0x384,%ecx
mov    %ecx,0x2f06(%rip)
ret

LLVM IR (-O0):
@f.ij = internal global i32 10
define i32 @f(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i64 %1, i64* %4
store i32 10, i32* %5
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = load i64, i64* %4
%10 = add nsw i64 %8, %9
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = add nsw i64 %10, %12
%14 = load i32, i32* @f.ij
%15 = sext i32 %14 to i64
%16 = add nsw i64 %13, %15
%17 = trunc i64 %16 to i32
store i32 %17, i32* %6
%18 = load i32, i32* @f.ij
%19 = add nsw i32 %18, 900
store i32 %19, i32* @f.ij
%20 = load i32, i32* %6
ret i32 %20
}

LLVM IR (-O2):
@f.ij = internal unnamed_addr global i32 10
define i32 @f(i32 %0, i64 %1) {
%3 = load i32, i32* @f.ij
%4 = trunc i64 %1 to i32
%5 = add i32 %0, 10
%6 = add i32 %5, %4
%7 = add i32 %6, %3
%8 = add nsw i32 %3, 900
store i32 %8, i32* @f.ij
ret i32 %7
}
int main(int argc, char **argv) {
  return ({
    int x = 5;
    x = x + 3;
    x *x;
  });
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 64
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int XESetFlushGC() {
  printf("XESetFlushGC called\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [20 x i8] c"XESetFlushGC called\00"
define i32 @XESetFlushGC() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
double norm(double, double, double, double);
double norm100(double value, double max) {
  return norm(value, 0.0, max, 100.0);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
xorps  %xmm1,%xmm1
movsd  0xec9(%rip),%xmm3
call   1030 <norm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
movaps %xmm1,%xmm2
movsd  0xee5(%rip),%xmm3
xorps  %xmm1,%xmm1
jmp    1030 <norm@plt>

LLVM IR (-O0):
define double @norm100(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 @norm(double %5, double 0.000000e+00, double %6, double 1.000000e+02)
ret double %7
}

LLVM IR (-O2):
define double @norm100(double %0, double %1) {
%3 = tail call double @norm(double %0, double 0.000000e+00, double %1, double 1.000000e+02)
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
unsigned short ehrpwm_read(int /*<<< orphan*/, int);
int /*<<< orphan*/ ehrpwm_write(int /*<<< orphan*/, int, unsigned short);
int ehrpwm_tz_clr_evt_status(uint8_t module) {
  unsigned short ret;
  ret = ehrpwm_read(module, 0x2C);
  ehrpwm_write(module, 0x2E, ret & ~0x1);
  return 0;
}


x86 assembly (clang, -O0):
<ehrpwm_tz_clr_evt_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2c,%esi
call   1030 <ehrpwm_read@plt>
mov    %ax,-0x6(%rbp)
mov    -0x4(%rbp),%edi
movzwl -0x6(%rbp),%eax
and    $0xfffffffe,%eax
mov    $0x2e,%esi
movzwl %ax,%edx
call   1040 <ehrpwm_write@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ehrpwm_tz_clr_evt_status>:
push   %rbx
mov    %edi,%ebx
mov    $0x2c,%esi
call   1030 <ehrpwm_read@plt>
and    $0xfffe,%eax
mov    %ebx,%edi
mov    $0x2e,%esi
mov    %eax,%edx
call   1040 <ehrpwm_write@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ehrpwm_tz_clr_evt_status(i32 %0) {
%2 = alloca i32
%3 = alloca i16
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call zeroext i16 @ehrpwm_read(i32 %4, i32 44)
store i16 %5, i16* %3
%6 = load i32, i32* %2
%7 = load i16, i16* %3
%8 = zext i16 %7 to i32
%9 = and i32 %8, -2
%10 = trunc i32 %9 to i16
%11 = call i32 @ehrpwm_write(i32 %6, i32 46, i16 zeroext %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @ehrpwm_tz_clr_evt_status(i32 %0) {
%2 = tail call zeroext i16 @ehrpwm_read(i32 %0, i32 44)
%3 = and i16 %2, -2
%4 = tail call i32 @ehrpwm_write(i32 %0, i32 46, i16 zeroext %3)
ret i32 0
}
/* Variables and functions */
int sscanf(char const *, char *, int *);
int ftp_retcode(const char *s) {
  int i;
  if (sscanf(s, "%d ", &i) == 1)
    return i;
  return -1;
}


x86 assembly (clang, -O0):
<ftp_retcode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <sscanf@plt>
cmp    $0x1,%eax
jne    1144 <ftp_retcode+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <ftp_retcode+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftp_retcode>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x1,%ecx
jne    1132 <ftp_retcode+0x22>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define i32 @ftp_retcode(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %4)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i32, i32* %4
store i32 %9, i32* %2
br label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %11
11: ; preds = %10, %8
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @ftp_retcode(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = icmp eq i32 %4, 1
%6 = load i32, i32* %2
%7 = select i1 %5, i32 %6, i32 -1
ret i32 %7
}
int ft_strlen(char *str) {
  return ((*str == '\0') ? 0 : (1 + ft_strlen(++str)));
}


x86 assembly (clang, -O0):
<ft_strlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1136 <ft_strlen+0x26>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <ft_strlen+0x3d>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    %rdi,-0x8(%rbp)
call   1030 <ft_strlen@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strlen>:
cmpb   $0x0,(%rdi)
je     111c <ft_strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <ft_strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %7, %4 ], [ %0, %1 ]
%6 = phi i32 [ %8, %4 ], [ 0, %1 ]
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = add nuw nsw i32 %6, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ XPixmapFormatValues;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void free_XPixmapFormatValues(void *_p) {
  if (_p == NULL)
    abort();
  free((XPixmapFormatValues *)_p);
}


x86 assembly (clang, -O0):
<free_XPixmapFormatValues>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113e <free_XPixmapFormatValues+0x1e>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_XPixmapFormatValues>:
test   %rdi,%rdi
je     112a <free_XPixmapFormatValues+0xa>
jmp    1030 <free@plt>
push   %rax
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define void @free_XPixmapFormatValues(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to i32*
%10 = call i32 @free(i32* %9)
ret void
}

LLVM IR (-O2):
define void @free_XPixmapFormatValues(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
%6 = bitcast i8* %0 to i32*
%7 = tail call i32 @free(i32* %6)
ret void
}
void foo291() {}


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

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

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

LLVM IR (-O2):
define void @foo291() {
ret void
}