xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ emit_u(int);
void emit_write(unsigned c10, unsigned rb, unsigned ra, unsigned cond) {
  assert((c10 & ~0x3FFU) == 0);
  emit_u(0xE0000000U | (c10 << 16) | (rb << 12) | (ra << 8) | cond);
}


x86 assembly (clang, -O0):
<emit_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffffc00,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%edi
shl    $0x10,%edi
or     $0xe0000000,%edi
mov    -0x8(%rbp),%eax
shl    $0xc,%eax
or     %eax,%edi
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
or     %eax,%edi
or     -0x10(%rbp),%edi
call   1040 <emit_u@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_write>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%ebx
mov    %edi,%r15d
xor    %edi,%edi
cmp    $0x400,%r15d
setb   %dil
call   1030 <assert@plt>
shl    $0x10,%r15d
shl    $0xc,%ebx
or     %r15d,%ebx
shl    $0x8,%ebp
or     %r14d,%ebp
or     %ebx,%ebp
or     $0xe0000000,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <emit_u@plt>

LLVM IR (-O0):
define void @emit_write(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = and i32 %9, -1024
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i32, i32* %5
%15 = shl i32 %14, 16
%16 = or i32 -536870912, %15
%17 = load i32, i32* %6
%18 = shl i32 %17, 12
%19 = or i32 %16, %18
%20 = load i32, i32* %7
%21 = shl i32 %20, 8
%22 = or i32 %19, %21
%23 = load i32, i32* %8
%24 = or i32 %22, %23
%25 = call i32 @emit_u(i32 %24)
ret void
}

LLVM IR (-O2):
define void @emit_write(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp ult i32 %0, 1024
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = shl i32 %0, 16
%9 = shl i32 %1, 12
%10 = shl i32 %2, 8
%11 = or i32 %8, %9
%12 = or i32 %11, %10
%13 = or i32 %12, %3
%14 = or i32 %13, -536870912
%15 = tail call i32 @emit_u(i32 %14)
ret void
}
/* Variables and functions */
int connect_sock(char const *, int, char *);
int connect_TCP(const char *host, int port) {
  return connect_sock(host, port, "tcp");
}


x86 assembly (clang, -O0):
<connect_TCP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    0xed3(%rip),%rdx
call   1030 <connect_sock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<connect_TCP>:
lea    0xee9(%rip),%rdx
jmp    1030 <connect_sock@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"tcp\00"
define i32 @connect_TCP(i8* %0, i32 %1) {
%3 = tail call i32 @connect_sock(i8* %0, i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 %3
}
/* Variables and functions */
int fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int errprint(char *str) { return fprintf(stderr, "%s\n", str); }


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

x86 assembly (clang, -O2):
<errprint>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @errprint(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 %3
}
/* Type definitions */
typedef int wchar_t;
typedef int /*<<< orphan*/ mbstate_t;

/* Variables and functions */
size_t wcrtomb(char *str, wchar_t wc, mbstate_t *ps) {
  *str = wc & 0xFF;
  return 1;
}


x86 assembly (clang, -O0):
<wcrtomb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcrtomb>:
mov    %sil,(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i64 @wcrtomb(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32, i32* %5
%8 = and i32 %7, 255
%9 = trunc i32 %8 to i8
%10 = load i8*, i8** %4
store i8 %9, i8* %10
ret i64 1
}

LLVM IR (-O2):
define i64 @wcrtomb(i8* nocapture writeonly %0, i32 %1, i32* nocapture readnone %2) {
%4 = trunc i32 %1 to i8
store i8 %4, i8* %0
ret i64 1
}
/* Variables and functions */
int /*<<< orphan*/ foobar(int, int *);
main() {
  int i;
  foobar(i, &i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%edi
lea    -0x4(%rbp),%rsi
call   1030 <foobar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rsi
call   1030 <foobar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @foobar(i32 %2, i32* %1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @foobar(i32 undef, i32* %1)
ret i32 0
}
void tomtomgo_backlight_off(void) {
  unsigned gpbdat = *((volatile unsigned *)0x56000014);
  gpbdat &= ~(0x1 << 0);
  *((volatile unsigned *)0x56000014) = gpbdat;
}


x86 assembly (clang, -O0):
<tomtomgo_backlight_off>:
push   %rbp
mov    %rsp,%rbp
mov    $0x56000014,%eax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffffffe,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x56000014,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<tomtomgo_backlight_off>:
andl   $0xfffffffe,0x56000014
fe
ret

LLVM IR (-O0):
define void @tomtomgo_backlight_off() {
%1 = alloca i32
%2 = load volatile i32, i32* inttoptr (i64 1442840596 to i32*)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = and i32 %3, -2
store i32 %4, i32* %1
%5 = load i32, i32* %1
store volatile i32 %5, i32* inttoptr (i64 1442840596 to i32*)
ret void
}

LLVM IR (-O2):
define void @tomtomgo_backlight_off() {
%1 = load volatile i32, i32* inttoptr (i64 1442840596 to i32*)
%2 = and i32 %1, -2
store volatile i32 %2, i32* inttoptr (i64 1442840596 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ unlink(char *);
void deleteImageWithID(char *aOrderID) {
  char aFileName[200];
  strcpy(aFileName, "/srv/http/barcodeImages/");
  strcat(aFileName, aOrderID);
  strcat(aFileName, ".png");
  unlink(aFileName);
}


x86 assembly (clang, -O0):
<deleteImageWithID>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xd0(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0xd0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0xd0(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1050 <strcat@plt>
lea    -0xd0(%rbp),%rdi
call   1030 <unlink@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deleteImageWithID>:
push   %r14
push   %rbx
sub    $0xc8,%rsp
mov    %rdi,%r14
lea    0xebc(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
add    $0xc8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"/srv/http/barcodeImages/\00"
@.str.1 = [5 x i8] c".png\00"
define void @deleteImageWithID(i8* %0) {
%2 = alloca i8*
%3 = alloca [200 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = call i32 @strcat(i8* %6, i8* %7)
%9 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%10 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%11 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%12 = call i32 @unlink(i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"/srv/http/barcodeImages/\00"
@.str.1 = [5 x i8] c".png\00"
define void @deleteImageWithID(i8* %0) {
%2 = alloca [200 x i8]
%3 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @strcat(i8* %3, i8* %0)
%6 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @unlink(i8* %3)
ret void
}
void f(int *b, int *c) {
  int *t = b;
  *b = *c;
  *c = *t;
}


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

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

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

LLVM IR (-O2):
define void @f(i32* nocapture writeonly %0, i32* nocapture %1) {
%3 = load i32, i32* %1
store i32 %3, i32* %0
store i32 %3, i32* %1
ret void
}
/* Variables and functions */
int tuner_i2c_read(void *, unsigned short, unsigned char, int, unsigned char *,
                   int);
int fc8300b_read(void *handle, unsigned short devid, unsigned char addr,
                 unsigned char *data) {
  int res;
  res = tuner_i2c_read(handle, devid, addr, 1, data, 1);
  return res;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %si,%dx
mov    %rdi,-0x8(%rbp)
mov    %dx,-0xa(%rbp)
mov    %al,-0xb(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%cx
mov    -0xb(%rbp),%al
mov    -0x18(%rbp),%r8
mov    $0x1,%r9d
movzwl %cx,%esi
movzbl %al,%edx
mov    %r9d,%ecx
call   1030 <tuner_i2c_read@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %rcx,%r8
mov    $0x1,%ecx
mov    $0x1,%r9d
jmp    1030 <tuner_i2c_read@plt>

LLVM IR (-O0):
define i32 @fc8300b_read(i8* %0, i16 zeroext %1, i8 zeroext %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i16
%7 = alloca i8
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i16 %1, i16* %6
store i8 %2, i8* %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = load i16, i16* %6
%12 = load i8, i8* %7
%13 = load i8*, i8** %8
%14 = call i32 @tuner_i2c_read(i8* %10, i16 zeroext %11, i8 zeroext %12, i32 1, i8* %13, i32 1)
store i32 %14, i32* %9
%15 = load i32, i32* %9
ret i32 %15
}

LLVM IR (-O2):
define i32 @fc8300b_read(i8* %0, i16 zeroext %1, i8 zeroext %2, i8* %3) {
%5 = tail call i32 @tuner_i2c_read(i8* %0, i16 zeroext %1, i8 zeroext %2, i32 1, i8* %3, i32 1)
ret i32 %5
}
int increment(int arg) { return (arg + 1); }


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

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

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

LLVM IR (-O2):
define i32 @increment(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M108_f(char *s) {
  debug("M108_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M108_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M108_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M108_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M108_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M108_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M108_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
void double_swap(size_t i, size_t j, double *array) {
  double hold;
  hold = array[i];
  array[i] = array[j];
  array[j] = hold;
}


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

x86 assembly (clang, -O2):
<double_swap>:
movsd  (%rdx,%rdi,8),%xmm0
movsd  (%rdx,%rsi,8),%xmm1
movsd  %xmm1,(%rdx,%rdi,8)
movsd  %xmm0,(%rdx,%rsi,8)
ret

LLVM IR (-O0):
define void @double_swap(i64 %0, i64 %1, double* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca double*
%7 = alloca double
store i64 %0, i64* %4
store i64 %1, i64* %5
store double* %2, double** %6
%8 = load double*, double** %6
%9 = load i64, i64* %4
%10 = getelementptr inbounds double, double* %8, i64 %9
%11 = load double, double* %10
store double %11, double* %7
%12 = load double*, double** %6
%13 = load i64, i64* %5
%14 = getelementptr inbounds double, double* %12, i64 %13
%15 = load double, double* %14
%16 = load double*, double** %6
%17 = load i64, i64* %4
%18 = getelementptr inbounds double, double* %16, i64 %17
store double %15, double* %18
%19 = load double, double* %7
%20 = load double*, double** %6
%21 = load i64, i64* %5
%22 = getelementptr inbounds double, double* %20, i64 %21
store double %19, double* %22
ret void
}

LLVM IR (-O2):
define void @double_swap(i64 %0, i64 %1, double* nocapture %2) {
%4 = getelementptr inbounds double, double* %2, i64 %0
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %2, i64 %1
%7 = load double, double* %6
store double %7, double* %4
store double %5, double* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ grava_li(int, char *);
void rot11_sem() { grava_li(1, "$ELSE"); }


x86 assembly (clang, -O0):
<rot11_sem>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xee0(%rip),%rsi
call   1030 <grava_li@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot11_sem>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edi
jmp    1030 <grava_li@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"$ELSE\00"
define void @rot11_sem() {
%1 = call i32 @grava_li(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"$ELSE\00"
define void @rot11_sem() {
%1 = tail call i32 @grava_li(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct tcb {
  int dummy;
};

/* Variables and functions */
int do_dup2(struct tcb *, int);
int sys_dup2(struct tcb *tcp) { return do_dup2(tcp, -1); }


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

x86 assembly (clang, -O2):
<sys_dup2>:
mov    $0xffffffff,%esi
jmp    1030 <do_dup2@plt>

LLVM IR (-O0):
%struct.tcb = type { i32 }
define i32 @sys_dup2(%struct.tcb* %0) {
%2 = alloca %struct.tcb*
store %struct.tcb* %0, %struct.tcb** %2
%3 = load %struct.tcb*, %struct.tcb** %2
%4 = call i32 @do_dup2(%struct.tcb* %3, i32 -1)
ret i32 %4
}

LLVM IR (-O2):
%struct.tcb = type { i32 }
define i32 @sys_dup2(%struct.tcb* %0) {
%2 = tail call i32 @do_dup2(%struct.tcb* %0, i32 -1)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ tss_t;

/* Variables and functions */
int /*<<< orphan*/ __pthread_key_delete(int /*<<< orphan*/);
void tss_delete(tss_t key) { __pthread_key_delete(key); }


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

x86 assembly (clang, -O2):
<tss_delete>:
jmp    1030 <__pthread_key_delete@plt>

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

LLVM IR (-O2):
define void @tss_delete(i32 %0) {
%2 = tail call i32 @__pthread_key_delete(i32 %0)
ret void
}
/* Variables and functions */
int geteuid();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%u\n", geteuid());
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @geteuid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
unsigned long long int int_gcd(unsigned long long int a,
                               unsigned long long int b) {
  while (b != 0) {
    const unsigned long long int t = b;
    b = a % b;
    a = t;
  }
  return a;
}


x86 assembly (clang, -O0):
<int_gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113c <int_gcd+0x3c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    110c <int_gcd+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @int_gcd(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %6, %4 ], [ %0, %2 ]
%6 = phi i64 [ %7, %4 ], [ %1, %2 ]
%7 = urem i64 %5, %6
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i64 [ %0, %2 ], [ %6, %4 ]
ret i64 %10
}
void ff_hevc_put_hevc_uni_w_epel_hv4_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_w_epel_hv4_12_sse4() {
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int atoi(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ test(int);
int main(int argc, char *argv[]) {
  int i = 0;
  if (argc == 2)
    i = atoi(argv[1]);
  else
    i = 10;
  printf("arg is %d\n", i);
  test(i);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    116c <main+0x3c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    1173 <main+0x43>
movl   $0xa,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
call   1050 <test@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa,%ebx
cmp    $0x2,%edi
jne    1146 <main+0x16>
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%ebx
lea    0xeb3(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1050 <test@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"arg is %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %6
br label %15
14: ; preds = %2
store i32 10, i32* %6
br label %15
15: ; preds = %14, %9
%16 = load i32, i32* %6
%17 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %6
%19 = call i32 @test(i32 %18)
%20 = load i32, i32* @EXIT_SUCCESS
ret i32 %20
}

LLVM IR (-O2):
@.str = [11 x i8] c"arg is %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ 10, %2 ]
%10 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = tail call i32 @test(i32 %9)
%12 = load i32, i32* @EXIT_SUCCESS
ret i32 %12
}
/* Variables and functions */
long double expl(long double);
long double sinhl(long double x) {
  x = expl(x);
  return ((x - (1.0 / x)) / 2.0);
}


x86 assembly (clang, -O0):
<sinhl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <expl@plt>
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fld1
fchs
fdiv   %st(1),%st
faddp  %st,%st(1)
flds   0xec1(%rip)
fdivrp %st,%st(1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinhl>:
sub    $0x18,%rsp
fldt   0x20(%rsp)
fstpt  (%rsp)
call   1030 <expl@plt>
fld1
fchs
fdiv   %st(1),%st
faddp  %st,%st(1)
fmuls  0xed2(%rip)
add    $0x18,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @sinhl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call x86_fp80 @expl(x86_fp80 %3)
store x86_fp80 %4, x86_fp80* %2
%5 = load x86_fp80, x86_fp80* %2
%6 = load x86_fp80, x86_fp80* %2
%7 = fdiv x86_fp80 0xK3FFF8000000000000000, %6
%8 = fsub x86_fp80 %5, %7
%9 = fdiv x86_fp80 %8, 0xK40008000000000000000
ret x86_fp80 %9
}

LLVM IR (-O2):
define x86_fp80 @sinhl(x86_fp80 %0) {
%2 = tail call x86_fp80 @expl(x86_fp80 %0)
%3 = fdiv x86_fp80 0xK3FFF8000000000000000, %2
%4 = fsub x86_fp80 %2, %3
%5 = fmul x86_fp80 %4, 0xK3FFE8000000000000000
ret x86_fp80 %5
}
void sumar_nodos(int dato, void *extra) { *((int *)extra) += dato; }


x86 assembly (clang, -O0):
<sumar_nodos>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumar_nodos>:
add    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @sumar_nodos(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 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = add nsw i32 %8, %5
store i32 %9, i32* %7
ret void
}

LLVM IR (-O2):
define void @sumar_nodos(i32 %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = add nsw i32 %4, %0
store i32 %5, i32* %3
ret void
}
/* Variables and functions */
int random();
int randomize_decay_time(int decay_time) { return random() % decay_time; }


x86 assembly (clang, -O0):
<randomize_decay_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <random@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomize_decay_time>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <random@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @randomize_decay_time(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @random()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @randomize_decay_time(i32 %0) {
%2 = tail call i32 (...) @random()
%3 = srem i32 %2, %0
ret i32 %3
}
int tolower(int c) {
  if (c >= 'A' && c <= 'Z')
    return 'a' - 'A' + c;
  return c;
}


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     1129 <tolower+0x29>
cmpl   $0x5a,-0x8(%rbp)
jg     1129 <tolower+0x29>
mov    -0x8(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <tolower+0x2f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
lea    -0x41(%rdi),%ecx
lea    0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int write_ensure(int, char const *, int /*<<< orphan*/);
int write_ensure_str(int fd, const char *str) {
  return write_ensure(fd, str, strlen(str));
}


x86 assembly (clang, -O0):
<write_ensure_str>:
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   1040 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <write_ensure@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @write_ensure_str(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 @write_ensure(i32 %5, i8* %6, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @write_ensure_str(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @write_ensure(i32 %0, i8* %1, i32 %3)
ret i32 %4
}
int keys_destroyInput() { return 1; }


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

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

LLVM IR (-O0):
define i32 @keys_destroyInput() {
ret i32 1
}

LLVM IR (-O2):
define i32 @keys_destroyInput() {
ret i32 1
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int);
void main() { printf("EOF = %d\n", EOF); }


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

x86 assembly (clang, -O2):
<main>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <printf@plt>

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

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

/* Variables and functions */
uint64_t shla(uint64_t a, uint64_t dabits) {
  uint64_t high = 0;
  uint64_t low = 0;
  dabits = dabits % 64;
  if (dabits == 0) {
    return a;
  }
  high = a << dabits;
  low = a >> (64 - dabits);
  return high | low;
}


x86 assembly (clang, -O0):
<shla>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    113b <shla+0x3b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115f <shla+0x5f>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x40,%ecx
sub    -0xc(%rbp),%ecx
sar    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shla>:
lea    0x3f(%rsi),%eax
test   %esi,%esi
cmovns %esi,%eax
and    $0xffffffc0,%eax
sub    %eax,%esi
mov    %edi,%edx
mov    %esi,%ecx
shl    %cl,%edx
neg    %cl
mov    %edi,%eax
sar    %cl,%eax
or     %edx,%eax
test   %esi,%esi
cmove  %edi,%eax
ret

LLVM IR (-O0):
define i32 @shla(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = load i32, i32* %5
%9 = srem i32 %8, 64
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i32, i32* %4
store i32 %13, i32* %3
br label %25
14: ; preds = %2
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = shl i32 %15, %16
store i32 %17, i32* %6
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = sub nsw i32 64, %19
%21 = ashr i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = or i32 %22, %23
store i32 %24, i32* %3
br label %25
25: ; preds = %14, %12
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @shla(i32 %0, i32 %1) {
%3 = srem i32 %1, 64
%4 = icmp eq i32 %3, 0
%5 = shl i32 %0, %3
%6 = sub nsw i32 64, %3
%7 = ashr i32 %0, %6
%8 = or i32 %7, %5
%9 = select i1 %4, i32 %0, i32 %8
ret i32 %9
}
void ar9003_mci_get_isr(struct ath_hw *ah, enum ath9k_int *masked) {}


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

x86 assembly (clang, -O2):
ret

LLVM IR (-O0):
%struct.ath_hw = type opaque
define void @ar9003_mci_get_isr(%struct.ath_hw* %0, i32* %1) {
%3 = alloca %struct.ath_hw*
%4 = alloca i32*
store %struct.ath_hw* %0, %struct.ath_hw** %3
store i32* %1, i32** %4
ret void
}

LLVM IR (-O2):
%struct.ath_hw = type opaque
define void @ar9003_mci_get_isr(%struct.ath_hw* nocapture %0, i32* nocapture %1) {
ret void
}
/* Variables and functions */
char toupper(char);
int isBoolean(char c) {
  c = toupper(c);
  return ('T' == c || 'F' == c);
}


x86 assembly (clang, -O0):
<isBoolean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
mov    $0x1,%al
mov    $0x54,%ecx
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
je     1151 <isBoolean+0x41>
movsbl -0x1(%rbp),%ecx
mov    $0x46,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isBoolean>:
push   %rax
call   1030 <toupper@plt>
cmp    $0x54,%al
sete   %cl
cmp    $0x46,%al
sete   %al
or     %cl,%al
movzbl %al,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @isBoolean(i8 signext %0) {
%2 = tail call signext i8 @toupper(i8 signext %0)
%3 = icmp eq i8 %2, 84
%4 = icmp eq i8 %2, 70
%5 = or i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
int test_imm_52int16_mem(short *val) {
  return ((*val) & (-0x52 << 0)) ? -20 : -40;
}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ readserialdata(int, char *, int);
void readtonextprompt(int fd) {
  char retbuf[4096];
  readserialdata(fd, retbuf, sizeof(retbuf));
}


x86 assembly (clang, -O0):
<readtonextprompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1010,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x1010(%rbp),%rsi
mov    $0x1000,%edx
call   1030 <readserialdata@plt>
add    $0x1010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readtonextprompt>:
sub    $0x1008,%rsp
mov    %rsp,%rsi
mov    $0x1000,%edx
call   1030 <readserialdata@plt>
add    $0x1008,%rsp
ret

LLVM IR (-O0):
define void @readtonextprompt(i32 %0) {
%2 = alloca i32
%3 = alloca [4096 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%6 = call i32 @readserialdata(i32 %4, i8* %5, i32 4096)
ret void
}

LLVM IR (-O2):
define void @readtonextprompt(i32 %0) {
%2 = alloca [4096 x i8]
%3 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%4 = call i32 @readserialdata(i32 %0, i8* %3, i32 4096)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CG_Error(char *, char const *);
char *COM_Parse(char **);
char *CG_MustParse(char **pString, const char *pErrorMsg) {
  char *token = COM_Parse(pString);
  if (!*token) {
    CG_Error("%s", pErrorMsg);
  }
  return token;
}


x86 assembly (clang, -O0):
<CG_MustParse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <COM_Parse@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
jne    115a <CG_MustParse+0x3a>
mov    -0x10(%rbp),%rsi
lea    0xeab(%rip),%rdi
call   1030 <CG_Error@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CG_MustParse>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1040 <COM_Parse@plt>
mov    %rax,%rbx
cmpb   $0x0,(%rax)
jne    1143 <CG_MustParse+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1030 <CG_Error@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i8* @CG_MustParse(i8** %0, i8* %1) {
%3 = tail call i8* @COM_Parse(i8** %0)
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @CG_Error(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %8
8: ; preds = %6, %2
ret i8* %3
}
/* Variables and functions */
char **realloc(char **, int);
int put_into_string_array(char ***array, int len, char item[]) {
  char **const arr = realloc(*array, sizeof(char *) * (len + 1));
  if (arr != NULL) {
    *array = arr;
    arr[len++] = item;
  }
  return len;
}


x86 assembly (clang, -O0):
<put_into_string_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
call   1030 <realloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1171 <put_into_string_array+0x61>
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0xc(%rbp)
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_into_string_array>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebx
mov    %rdi,%r15
mov    (%rdi),%rdi
lea    0x8(,%rbx,8),%esi
call   1030 <realloc@plt>
test   %rax,%rax
je     113e <put_into_string_array+0x2e>
mov    %rax,(%r15)
movslq %ebx,%rcx
add    $0x1,%ebx
mov    %r14,(%rax,%rcx,8)
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @put_into_string_array(i8*** nocapture %0, i32 %1, i8* %2) {
%4 = load i8**, i8*** %0
%5 = add nsw i32 %1, 1
%6 = shl i32 %5, 3
%7 = tail call i8** @realloc(i8** %4, i32 %6)
%8 = icmp eq i8** %7, null
br i1 %8, label %12, label %9
9: ; preds = %3
store i8** %7, i8*** %0
%10 = sext i32 %1 to i64
%11 = getelementptr inbounds i8*, i8** %7, i64 %10
store i8* %2, i8** %11
br label %12
12: ; preds = %9, %3
%13 = phi i32 [ %5, %9 ], [ %1, %3 ]
ret i32 %13
}
/* Variables and functions */
int execlp(char const *, char const *, char const *, void *);
int g_execlp3(const char *a1, const char *a2, const char *a3) {
  return execlp(a1, a2, a3, (void *)0);
}


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

x86 assembly (clang, -O2):
<g_execlp3>:
xor    %ecx,%ecx
jmp    1030 <execlp@plt>

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

LLVM IR (-O2):
define i32 @g_execlp3(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @execlp(i8* %0, i8* %1, i8* %2, i8* null)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int fscanf(int /*<<< orphan*/, char *, double *);
char getchar();
int /*<<< orphan*/ stdin;
double read_number() {
  double x = 0;
  assert(fscanf(stdin, "%lf", &x) == 1);
  while ((getchar() != '\n'))
    ;
  return x;
}


x86 assembly (clang, -O0):
<read_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1181 <read_number+0x51>
jmp    1169 <read_number+0x39>
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_number>:
push   %rax
movq   $0x0,(%rsp)
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
mov    %rsp,%rdx
call   1030 <fscanf@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
nop
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1160 <read_number+0x30>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [4 x i8] c"%lf\00"
define double @read_number() {
%1 = alloca double
store double 0.000000e+00, double* %1
%2 = load i32, i32* @stdin
%3 = call i32 @fscanf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = icmp eq i32 %3, 1
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
br label %7
7: ; preds = %11, %0
%8 = call signext i8 (...) @getchar()
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 10
br i1 %10, label %11, label %12
11: ; preds = %7
br label %7
12: ; preds = %7
%13 = load double, double* %1
ret double %13
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [4 x i8] c"%lf\00"
define double @read_number() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store double 0.000000e+00, double* %1
%3 = load i32, i32* @stdin
%4 = call i32 @fscanf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%5 = icmp eq i32 %4, 1
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
br label %8
8: ; preds = %8, %0
%9 = call signext i8 (...) @getchar()
%10 = icmp eq i8 %9, 10
br i1 %10, label %11, label %8
11: ; preds = %8
%12 = load double, double* %1
ret double %12
}
/* Variables and functions */
float sinf(float);
float futrts_sin32(float x) { return sinf(x); }


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

x86 assembly (clang, -O2):
<futrts_sin32>:
jmp    1030 <sinf@plt>

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

LLVM IR (-O2):
define float @futrts_sin32(float %0) {
%2 = tail call float @sinf(float %0)
ret float %2
}