xunge/DecIR huggingface dataset:
int ft_is_op(char c) {
  return (c == '+' || c == '-' || c == '*' || c == '/' || c == '%' ||
          c == '(' || c == ')');
}


x86 assembly (clang, -O0):
<ft_is_op>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2b,%ecx
mov    %al,-0x2(%rbp)
je     1183 <ft_is_op+0x83>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2d,%ecx
mov    %al,-0x2(%rbp)
je     1183 <ft_is_op+0x83>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2a,%ecx
mov    %al,-0x2(%rbp)
je     1183 <ft_is_op+0x83>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2f,%ecx
mov    %al,-0x2(%rbp)
je     1183 <ft_is_op+0x83>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x25,%ecx
mov    %al,-0x2(%rbp)
je     1183 <ft_is_op+0x83>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x28,%ecx
mov    %al,-0x2(%rbp)
je     1183 <ft_is_op+0x83>
movsbl -0x1(%rbp),%eax
cmp    $0x29,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_is_op>:
lea    -0x25(%rdi),%eax
cmp    $0xb,%al
jae    1119 <ft_is_op+0x19>
movzbl %al,%ecx
mov    $0x1,%eax
mov    $0x569,%edx
bt     %ecx,%edx
jb     1122 <ft_is_op+0x22>
xor    %eax,%eax
cmp    $0x29,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @ft_is_op(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 43
br i1 %5, label %30, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 45
br i1 %9, label %30, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 42
br i1 %13, label %30, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 47
br i1 %17, label %30, label %18
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 37
br i1 %21, label %30, label %22
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 40
br i1 %25, label %30, label %26
26: ; preds = %22
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 41
br label %30
30: ; preds = %26, %22, %18, %14, %10, %6, %1
%31 = phi i1 [ true, %22 ], [ true, %18 ], [ true, %14 ], [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %29, %26 ]
%32 = zext i1 %31 to i32
ret i32 %32
}

LLVM IR (-O2):
define i32 @ft_is_op(i8 signext %0) {
%2 = add i8 %0, -37
%3 = icmp ult i8 %2, 11
br i1 %3, label %7, label %4
4: ; preds = %7, %1
%5 = icmp eq i8 %0, 41
%6 = zext i1 %5 to i32
br label %12
7: ; preds = %1
%8 = zext i8 %2 to i16
%9 = lshr i16 1385, %8
%10 = and i16 %9, 1
%11 = icmp eq i16 %10, 0
br i1 %11, label %4, label %12
12: ; preds = %7, %4
%13 = phi i32 [ %6, %4 ], [ 1, %7 ]
ret i32 %13
}
int ptrace_sandbox_launch_process(struct pt_sandbox *p_sandbox,
                                  void (*p_func)(void *), void *p_arg) {
  (void)p_sandbox;
  (void)p_func;
  (void)p_arg;
  return -1;
}


x86 assembly (clang, -O0):
<ptrace_sandbox_launch_process>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.pt_sandbox = type opaque
define i32 @ptrace_sandbox_launch_process(%struct.pt_sandbox* %0, void (i8*)* %1, i8* %2) {
%4 = alloca %struct.pt_sandbox*
%5 = alloca void (i8*)*
%6 = alloca i8*
store %struct.pt_sandbox* %0, %struct.pt_sandbox** %4
store void (i8*)* %1, void (i8*)** %5
store i8* %2, i8** %6
%7 = load %struct.pt_sandbox*, %struct.pt_sandbox** %4
%8 = load void (i8*)*, void (i8*)** %5
%9 = load i8*, i8** %6
ret i32 -1
}

LLVM IR (-O2):
%struct.pt_sandbox = type opaque
define i32 @ptrace_sandbox_launch_process(%struct.pt_sandbox* nocapture readnone %0, void (i8*)* nocapture readnone %1, i8* nocapture readnone %2) {
ret i32 -1
}
/* Type definitions */
struct stat {
  scalar_t__ st_mtime;
};

/* Variables and functions */
int mtimecmp(struct stat *buf1, struct stat *buf2) {
  if (buf1->st_mtime < buf2->st_mtime)
    return -1;
  if (buf1->st_mtime > buf2->st_mtime)
    return +1;
  return 0;
}


x86 assembly (clang, -O0):
<mtimecmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
jge    112c <mtimecmp+0x2c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1153 <mtimecmp+0x53>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
jle    114c <mtimecmp+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    1153 <mtimecmp+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtimecmp>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
define i32 @mtimecmp(%struct.stat* %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca %struct.stat*
%5 = alloca %struct.stat*
store %struct.stat* %0, %struct.stat** %4
store %struct.stat* %1, %struct.stat** %5
%6 = load %struct.stat*, %struct.stat** %4
%7 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%8 = load i64, i64* %7
%9 = load %struct.stat*, %struct.stat** %5
%10 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 0
%11 = load i64, i64* %10
%12 = icmp slt i64 %8, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %24
14: ; preds = %2
%15 = load %struct.stat*, %struct.stat** %4
%16 = getelementptr inbounds %struct.stat, %struct.stat* %15, i32 0, i32 0
%17 = load i64, i64* %16
%18 = load %struct.stat*, %struct.stat** %5
%19 = getelementptr inbounds %struct.stat, %struct.stat* %18, i32 0, i32 0
%20 = load i64, i64* %19
%21 = icmp sgt i64 %17, %20
br i1 %21, label %22, label %23
22: ; preds = %14
store i32 1, i32* %3
br label %24
23: ; preds = %14
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %13
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
%struct.stat = type { i64 }
define i32 @mtimecmp(%struct.stat* nocapture %0, %struct.stat* nocapture %1) {
%3 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 0
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%6 = load i64, i64* %5
%7 = icmp slt i64 %4, %6
%8 = icmp sgt i64 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
int int_cos(int a) {
  int v, neg;
  a = a & ((1 << 8) - 1);
  if (a >= ((1 << 8) / 2))
    a = (1 << 8) - a;
  neg = 0;
  if (a > ((1 << 8) / 4)) {
    neg = -1;
    a = ((1 << 8) / 2) - a;
  }
  v = (1 << 8) - ((a * a) >> 4);
  v = (v ^ neg) - neg;
  return v;
}


x86 assembly (clang, -O0):
<int_cos>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x80,-0x4(%rbp)
jl     112a <int_cos+0x2a>
mov    $0x100,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x40,-0x4(%rbp)
jle    114d <int_cos+0x4d>
movl   $0xffffffff,-0xc(%rbp)
mov    $0x80,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
imul   -0x4(%rbp),%ecx
sar    $0x4,%ecx
mov    $0x100,%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_cos>:
movzbl %dil,%ecx
mov    $0x100,%eax
mov    $0x100,%edx
sub    %ecx,%edx
cmp    $0x7f,%ecx
cmovbe %ecx,%edx
mov    $0x80,%ecx
sub    %edx,%ecx
xor    %esi,%esi
cmp    $0x41,%edx
setae  %sil
cmovb  %edx,%ecx
mov    %esi,%edx
neg    %edx
imul   %ecx,%ecx
shr    $0x4,%ecx
sub    %ecx,%eax
xor    %edx,%eax
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @int_cos(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = and i32 %5, 255
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = icmp sge i32 %7, 128
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = sub nsw i32 256, %10
store i32 %11, i32* %2
br label %12
12: ; preds = %9, %1
store i32 0, i32* %4
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, 64
br i1 %14, label %15, label %18
15: ; preds = %12
store i32 -1, i32* %4
%16 = load i32, i32* %2
%17 = sub nsw i32 128, %16
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %12
%19 = load i32, i32* %2
%20 = load i32, i32* %2
%21 = mul nsw i32 %19, %20
%22 = ashr i32 %21, 4
%23 = sub nsw i32 256, %22
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = xor i32 %24, %25
%27 = load i32, i32* %4
%28 = sub nsw i32 %26, %27
store i32 %28, i32* %3
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @int_cos(i32 %0) {
%2 = and i32 %0, 255
%3 = icmp ugt i32 %2, 127
%4 = sub nuw nsw i32 256, %2
%5 = select i1 %3, i32 %4, i32 %2
%6 = icmp ugt i32 %5, 64
%7 = sub nsw i32 128, %5
%8 = select i1 %6, i32 %7, i32 %5
%9 = sext i1 %6 to i32
%10 = mul nsw i32 %8, %8
%11 = lshr i32 %10, 4
%12 = sub nsw i32 256, %11
%13 = xor i32 %12, %9
%14 = sub nsw i32 %13, %9
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("create-image - CPIO image creation utility\n"
         "Usage:\n");
  printf("\tcreate-image [options]\n");
  printf("Options:\n"
         "\t-o, --output <image>   Output CPIO image\n"
         "\t-h, --help             Show help options\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0e(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1a(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"create-image - CPIO image creation utility\0AUsage:\0A\00"
@.str.1 = [25 x i8] c"\09create-image [options]\0A\00"
@.str.2 = [94 x i8] c"Options:\0A\09-o, --output <image> Output CPIO image\0A\09-h, --help Show help options\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [50 x i8] c"create-image - CPIO image creation utility\0AUsage:\00"
@str.3 = [24 x i8] c"\09create-image [options]\00"
@str.4 = [93 x i8] c"Options:\0A\09-o, --output <image> Output CPIO image\0A\09-h, --help Show help options\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ bdos(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ getchi();
void flush() {
  while (bdos(11, NULL))
    bdos(1, NULL);
  getchi();
}


x86 assembly (clang, -O0):
<flush>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <flush+0x9>
mov    $0xb,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <bdos@plt>
cmp    $0x0,%rax
je     1154 <flush+0x34>
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <bdos@plt>
jmp    1129 <flush+0x9>
mov    $0x0,%al
call   1040 <getchi@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xb,%edi
xor    %esi,%esi
call   1030 <bdos@plt>
test   %rax,%rax
je     114f <flush+0x2f>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <bdos@plt>
jmp    1130 <flush+0x10>
xor    %eax,%eax
pop    %rcx
jmp    1040 <getchi@plt>

LLVM IR (-O0):
define void @flush() {
br label %1
1: ; preds = %4, %0
%2 = call i64 @bdos(i32 11, i32* null)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = call i64 @bdos(i32 1, i32* null)
br label %1
6: ; preds = %1
%7 = call i32 (...) @getchi()
ret void
}

LLVM IR (-O2):
define void @flush() {
%1 = tail call i64 @bdos(i32 11, i32* null)
%2 = icmp eq i64 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0, %3
%4 = tail call i64 @bdos(i32 1, i32* null)
%5 = tail call i64 @bdos(i32 11, i32* null)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %3
7: ; preds = %3, %0
%8 = tail call i32 (...) @getchi()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ do_csi(char *, int, int, int, int);
void brc3(int pn1, int pn2, int pn3, int c) {
  do_csi("%d;%d;%d%c", pn1, pn2, pn3, c);
}


x86 assembly (clang, -O0):
<brc3>:
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),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xec8(%rip),%rdi
call   1030 <do_csi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brc3>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
lea    0xee0(%rip),%rdi
jmp    1030 <do_csi@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"%d;%d;%d%c\00"
define void @brc3(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 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @do_csi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10, i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%d;%d;%d%c\00"
define void @brc3(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @do_csi(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ add_char(char);
void cm_comma(int arg) {
  if (arg == 0)
    add_char(',');
}


x86 assembly (clang, -O0):
<cm_comma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    112f <cm_comma+0x1f>
mov    $0x2c,%edi
call   1030 <add_char@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cm_comma>:
test   %edi,%edi
je     1115 <cm_comma+0x5>
ret
mov    $0x2c,%edi
jmp    1030 <add_char@plt>

LLVM IR (-O0):
define void @cm_comma(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @add_char(i8 signext 44)
br label %7
7: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @cm_comma(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @add_char(i8 signext 44)
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
struct undup {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ die(char *);
void und_trailer_finalize(struct undup *und) {
  die("Botch: und_trailer_finalize called.\n");
}


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

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

LLVM IR (-O0):
%struct.undup = type { i32 }
@.str = [37 x i8] c"Botch: und_trailer_finalize called.\0A\00"
define void @und_trailer_finalize(%struct.undup* %0) {
%2 = alloca %struct.undup*
store %struct.undup* %0, %struct.undup** %2
%3 = call i32 @die(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.undup = type { i32 }
@.str = [37 x i8] c"Botch: und_trailer_finalize called.\0A\00"
define void @und_trailer_finalize(%struct.undup* nocapture readnone %0) {
%2 = tail call i32 @die(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
bool less_than_zero(int x) { return x < 0; }


x86 assembly (clang, -O0):
<less_than_zero>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<less_than_zero>:
mov    %edi,%eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @less_than_zero(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @less_than_zero(i32 %0) {
%2 = lshr i32 %0, 31
ret i32 %2
}
adrreg0adrreg1(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{
  if ((p0[10000000]) <= (p1[1111111 / 4]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adrreg0adrreg1>:
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
movswl 0x1312d00(%rax),%eax
mov    -0x20(%rbp),%rcx
movswl 0x87a22(%rcx),%ecx
cmp    %ecx,%eax
jg     1149 <adrreg0adrreg1+0x49>
movl   $0x1,-0x4(%rbp)
jmp    1150 <adrreg0adrreg1+0x50>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrreg0adrreg1>:
movzwl 0x1312d00(%r8),%ecx
01
xor    %eax,%eax
cmp    0x87a22(%r9),%cx
setle  %al
ret

LLVM IR (-O0):
define i32 @adrreg0adrreg1(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 = getelementptr inbounds i16, i16* %16, i64 10000000
%18 = load i16, i16* %17
%19 = sext i16 %18 to i32
%20 = load i16*, i16** %13
%21 = getelementptr inbounds i16, i16* %20, i64 277777
%22 = load i16, i16* %21
%23 = sext i16 %22 to i32
%24 = icmp sle i32 %19, %23
br i1 %24, label %25, label %26
25: ; preds = %6
store i32 1, i32* %7
br label %27
26: ; preds = %6
store i32 0, i32* %7
br label %27
27: ; preds = %26, %25
%28 = load i32, i32* %7
ret i32 %28
}

LLVM IR (-O2):
define i32 @adrreg0adrreg1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture %4, i16* nocapture %5) {
%7 = getelementptr inbounds i16, i16* %4, i64 10000000
%8 = load i16, i16* %7
%9 = getelementptr inbounds i16, i16* %5, i64 277777
%10 = load i16, i16* %9
%11 = icmp sle i16 %8, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
void bar(void) { printf("Hello from %s!\n", __FUNCTION__); }


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

x86 assembly (clang, -O2):
<bar>:
lea    0xee9(%rip),%rdi
lea    0xef2(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Hello from %s!\0A\00"
@__FUNCTION__.bar = [4 x i8] c"bar\00"
define void @bar() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__FUNCTION__.bar, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Hello from %s!\0A\00"
@__FUNCTION__.bar = [4 x i8] c"bar\00"
define void @bar() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__FUNCTION__.bar, i64 0, i64 0))
ret void
}
__attribute__((__no__)) void do_nothing() { asm volatile("" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @do_nothing() {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
void lower(char *s) {
  while (*s) {
    ((*s > 'A' && *s < 'Z') ? *s += 32 : *s);
    ++s;
  }
}


x86 assembly (clang, -O0):
<lower>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1161 <lower+0x61>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jle    1149 <lower+0x49>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jge    1149 <lower+0x49>
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%eax
add    $0x20,%eax
mov    %al,(%rcx)
movsbl %al,%eax
jmp    1150 <lower+0x50>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <lower+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lower>:
mov    (%rdi),%al
test   %al,%al
je     112a <lower+0x2a>
add    $0x1,%rdi
jmp    111b <lower+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     112a <lower+0x2a>
lea    -0x42(%rax),%ecx
cmp    $0x17,%cl
ja     1110 <lower+0x10>
add    $0x20,%al
mov    %al,-0x1(%rdi)
jmp    1110 <lower+0x10>
ret

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

LLVM IR (-O2):
define void @lower(i8* nocapture %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, -66
%8 = icmp ult i8 %7, 24
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = add nuw nsw i8 %5, 32
store i8 %10, i8* %6
br label %11
11: ; preds = %4, %9
%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 void
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
int getint16le(char *buf) {
  int16_t res = (buf[1] << 8) | buf[0];
  return res;
}


x86 assembly (clang, -O0):
<getint16le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getint16le>:
movsbl 0x1(%rdi),%ecx
shl    $0x8,%ecx
movsbl (%rdi),%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @getint16le(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = shl i32 %7, 8
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = or i32 %8, %12
store i32 %13, i32* %3
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @getint16le(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = shl nsw i32 %4, 8
%6 = load i8, i8* %0
%7 = sext i8 %6 to i32
%8 = or i32 %5, %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
short SwapShort(short in) {
  char sin[2];
  char sout[2];
  memcpy((char *)sin, (char *)&in, 2);
  sout[0] = sin[1];
  sout[1] = sin[0];
  return *((short *)sout);
}


x86 assembly (clang, -O0):
<SwapShort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x2(%rbp),%rsi
mov    $0x2,%edx
call   1030 <memcpy@plt>
mov    -0x3(%rbp),%al
mov    %al,-0x6(%rbp)
mov    -0x4(%rbp),%al
mov    %al,-0x5(%rbp)
movswl -0x6(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SwapShort>:
push   %rax
mov    %di,0x4(%rsp)
lea    0x6(%rsp),%rdi
lea    0x4(%rsp),%rsi
mov    $0x2,%edx
call   1030 <memcpy@plt>
movzwl 0x6(%rsp),%eax
rol    $0x8,%ax
pop    %rcx
ret

LLVM IR (-O0):
define signext i16 @SwapShort(i16 signext %0) {
%2 = alloca i16
%3 = alloca [2 x i8]
%4 = alloca [2 x i8]
store i16 %0, i16* %2
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%6 = bitcast i16* %2 to i8*
%7 = call i32 @memcpy(i8* %5, i8* %6, i32 2)
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
%9 = load i8, i8* %8
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
store i8 %9, i8* %10
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%12 = load i8, i8* %11
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 1
store i8 %12, i8* %13
%14 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%15 = bitcast i8* %14 to i16*
%16 = load i16, i16* %15
ret i16 %16
}

LLVM IR (-O2):
define signext i16 @SwapShort(i16 signext %0) {
%2 = alloca i16
%3 = alloca [2 x i8]
store i16 %0, i16* %2
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = bitcast i16* %2 to i8*
%6 = call i32 @memcpy(i8* %4, i8* %5, i32 2)
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
%8 = load i8, i8* %7
%9 = load i8, i8* %4
%10 = zext i8 %9 to i16
%11 = shl nuw i16 %10, 8
%12 = zext i8 %8 to i16
%13 = or i16 %11, %12
ret i16 %13
}
int test_imm_40uint16_reg(unsigned short val) {
  return ((val) & (0x40 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_40uint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 64
%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_40uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 64
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
double stdlib_base_identity(const double x) { return x; }


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

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

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

LLVM IR (-O2):
define double @stdlib_base_identity(double returned %0) {
ret double %0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void mem_free(void *p, const char *file, int line) {
  ((void)file);
  ((void)line);
  if (p)
    free(p);
}


x86 assembly (clang, -O0):
<mem_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1137 <mem_free+0x27>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_free>:
test   %rdi,%rdi
je     111a <mem_free+0xa>
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
define void @mem_free(i8* %0, i8* nocapture readnone %1, i32 %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @free(i8* %0)
br label %7
7: ; preds = %5, %3
ret void
}
main() {
  return (struct A { int i, j; }){.i = 5}.j;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.A = type { i32, i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.A
store i32 0, i32* %1
%3 = getelementptr inbounds %struct.A, %struct.A* %2, i32 0, i32 0
store i32 5, i32* %3
%4 = getelementptr inbounds %struct.A, %struct.A* %2, i32 0, i32 1
store i32 0, i32* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int isupper(int character) {
  return ((character >= 'A') && (character <= 'Z'));
}


x86 assembly (clang, -O0):
<isupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x41,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <isupper+0x20>
cmpl   $0x5a,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isupper>:
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isupper(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 65
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 90
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @isupper(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
int sumofsquare(int n) {}


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

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

LLVM IR (-O0):
define i32 @sumofsquare(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 @sumofsquare(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void a_func_call2() { printf("Hello\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"Hello\00"
define void @a_func_call2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
void EUSCIB0_IRQHandler(void) {
  while (1) {
  }
}


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

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

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

LLVM IR (-O2):
define void @EUSCIB0_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
struct lifo {
  int dummy;
};

/* Variables and functions */
double asin(double);
double pop(struct lifo *);
double opr_asin(struct lifo *stack) {
  double op = pop(stack);
  return asin(op);
}


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

x86 assembly (clang, -O2):
<opr_asin>:
push   %rax
call   1030 <pop@plt>
pop    %rax
jmp    1040 <asin@plt>

LLVM IR (-O0):
%struct.lifo = type { i32 }
define double @opr_asin(%struct.lifo* %0) {
%2 = alloca %struct.lifo*
%3 = alloca double
store %struct.lifo* %0, %struct.lifo** %2
%4 = load %struct.lifo*, %struct.lifo** %2
%5 = call double @pop(%struct.lifo* %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = call double @asin(double %6)
ret double %7
}

LLVM IR (-O2):
%struct.lifo = type { i32 }
define double @opr_asin(%struct.lifo* %0) {
%2 = tail call double @pop(%struct.lifo* %0)
%3 = tail call double @asin(double %2)
ret double %3
}
int test_imm_A0uint16_mem(unsigned short *val) {
  return ((*val) & (0xA0 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_A0uint16_mem>:
testb  $0xa0,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_A0uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, 160
%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_A0uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 160
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ say(char *, int);
void talk(void) { say("A small table.", 1); }


x86 assembly (clang, -O0):
<talk>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x1,%esi
call   1030 <say@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<talk>:
lea    0xee9(%rip),%rdi
mov    $0x1,%esi
jmp    1030 <say@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"A small table.\00"
define void @talk() {
%1 = call i32 @say(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"A small table.\00"
define void @talk() {
%1 = tail call i32 @say(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
void getkey(key) const char *key;
{
  if (!getkeyopt(key))
    fatserror("missing '%s' keyword", key);
}


x86 assembly (clang, -O0):
<getkey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <getkeyopt@plt>
cmp    $0x0,%eax
jne    1152 <getkey+0x32>
mov    -0x8(%rbp),%rsi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <fatserror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getkey>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <getkeyopt@plt>
test   %eax,%eax
je     1131 <getkey+0x11>
pop    %rbx
ret
lea    0xec8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <fatserror@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"missing '%s' keyword\00"
define void @getkey(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @getkeyopt to i32 (i8*, ...)*)(i8* %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @fatserror to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"missing '%s' keyword\00"
define void @getkey(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @getkeyopt to i32 (i8*, ...)*)(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @fatserror to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %4, %1
ret void
}
int sdDebugResponse(int resp) {
  ;
  ;
  return resp;
}


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

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

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

LLVM IR (-O2):
define i32 @sdDebugResponse(i32 returned %0) {
ret i32 %0
}
void prefetchnta(void *ptr) {
  __asm__ volatile("prefetchnta (%0)" : : "r"(ptr));
}


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

x86 assembly (clang, -O2):
<prefetchnta>:
prefetchnta (%rdi)
ret

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

LLVM IR (-O2):
define void @prefetchnta(i8* %0) {
tail call void asm sideeffect "prefetchnta ($0)", "r,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret void
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int EDOM;
int safe_read(int, void *, size_t);
ssize_t safe_read_exact(int fd, void *b, size_t c) {
  int ret = safe_read(fd, b, c);
  if (ret < 0)
    return ret;
  if ((size_t)ret != c)
    return -EDOM;
  return 0;
}


x86 assembly (clang, -O0):
<safe_read_exact>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <safe_read@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    114b <safe_read_exact+0x3b>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1173 <safe_read_exact+0x63>
movslq -0x1c(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     116c <safe_read_exact+0x5c>
xor    %eax,%eax
mov    0x2e86(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1173 <safe_read_exact+0x63>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_read_exact>:
push   %rbx
mov    %rdx,%rbx
call   1030 <safe_read@plt>
test   %eax,%eax
js     1131 <safe_read_exact+0x21>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %rbx,%rcx
je     1131 <safe_read_exact+0x21>
mov    0x2ebb(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@EDOM = global i32 0
define i32 @safe_read_exact(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @safe_read(i32 %0, i8* %1, i64 %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %3
%7 = zext i32 %4 to i64
%8 = icmp eq i64 %7, %2
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = load i32, i32* @EDOM
%11 = sub nsw i32 0, %10
br label %12
12: ; preds = %6, %3, %9
%13 = phi i32 [ %11, %9 ], [ %4, %3 ], [ 0, %6 ]
ret i32 %13
}
int count_char(char s[], char a) {
  int count = 0, i = 0;
  while ((s[i] != '\0')) {
    if (s[i] == a) {
      count++;
    }
    i++;
  }
  return count;
}


x86 assembly (clang, -O0):
<count_char>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1160 <count_char+0x60>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1152 <count_char+0x52>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111c <count_char+0x1c>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_char>:
mov    (%rdi),%cl
test   %cl,%cl
je     1126 <count_char+0x26>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
xor    %edx,%edx
cmp    %sil,%cl
sete   %dl
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <count_char+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @count_char(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %12, %5 ], [ 0, %2 ]
%7 = phi i8 [ %14, %5 ], [ %3, %2 ]
%8 = phi i32 [ %11, %5 ], [ 0, %2 ]
%9 = icmp eq i8 %7, %1
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %8, %10
%12 = add nuw nsw i64 %6, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i32 [ 0, %2 ], [ %11, %5 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *get_shm_name(char const *);
int unlink(char *);
int shm_unlink(const char *name) {
  char *shm_name = get_shm_name(name);
  int ret;
  if (shm_name == NULL)
    return -1;
  ret = unlink(shm_name);
  free(shm_name);
  return ret;
}


x86 assembly (clang, -O0):
<shm_unlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <get_shm_name@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1160 <shm_unlink+0x30>
movl   $0xffffffff,-0x4(%rbp)
jmp    117b <shm_unlink+0x4b>
mov    -0x18(%rbp),%rdi
call   1040 <unlink@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shm_unlink>:
push   %rbp
push   %rbx
push   %rax
call   1050 <get_shm_name@plt>
test   %rax,%rax
je     1156 <shm_unlink+0x26>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <unlink@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
jmp    115b <shm_unlink+0x2b>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @shm_unlink(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @get_shm_name(i8* %6)
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %17
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = call i32 @unlink(i8* %12)
store i32 %13, i32* %5
%14 = load i8*, i8** %4
%15 = call i32 @free(i8* %14)
%16 = load i32, i32* %5
store i32 %16, i32* %2
br label %17
17: ; preds = %11, %10
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @shm_unlink(i8* %0) {
%2 = tail call i8* @get_shm_name(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @unlink(i8* %2)
%6 = tail call i32 @free(i8* %2)
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ %5, %4 ], [ -1, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ M_gameloop();
int /*<<< orphan*/ M_systemsinit();
void M_gameinit() {
  M_systemsinit();
  M_gameloop();
}


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

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

LLVM IR (-O0):
define void @M_gameinit() {
%1 = call i32 (...) @M_systemsinit()
%2 = call i32 (...) @M_gameloop()
ret void
}

LLVM IR (-O2):
define void @M_gameinit() {
%1 = tail call i32 (...) @M_systemsinit()
%2 = tail call i32 (...) @M_gameloop()
ret void
}
main() {
  int x, y;
  x = 0;
  y = 1;
  if (x == 1) {
    printf(y);
  } else if (x == 0) {
    y++;
    printf(y);
  } else {
    y--;
    printf(y);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1147 <main+0x37>
movslq -0xc(%rbp),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1183 <main+0x73>
cmpl   $0x0,-0x8(%rbp)
jne    116a <main+0x5a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117e <main+0x6e>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1183 <main+0x73>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 2 to i8*))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint16_t;

/* Variables and functions */
uint16_t dmc_unrar_unicode_read_uint16le_from_uint16(const void *opaque) {
  return *((const uint16_t *)opaque);
}


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

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

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

LLVM IR (-O2):
define i32 @dmc_unrar_unicode_read_uint16le_from_uint16(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}