xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
unsigned int alarm(unsigned int seconds) {
  printf("TODO: alarm() not yet implemented!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [36 x i8] c"TODO: alarm() not yet implemented!\0A\00"
define i32 @alarm(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [35 x i8] c"TODO: alarm() not yet implemented!\00"
define i32 @alarm(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ *gethostbyaddr(char const *, size_t, int);
int /*<<< orphan*/ printf(char *, char const *);
int _gethostbyaddr(char const *progname, char const *addr, size_t length,
                   int type) {
  printf("%s: Testing gethostbyaddr()\n", progname);
  return (gethostbyaddr(addr, length, type) != NULL) ? 0 : 1;
}


x86 assembly (clang, -O0):
<_gethostbyaddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <gethostbyaddr@plt>
mov    %rax,%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_gethostbyaddr>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %rdi,%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1040 <gethostbyaddr@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"%s: Testing gethostbyaddr()\0A\00"
define i32 @_gethostbyaddr(i8* %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %6
%12 = load i64, i64* %7
%13 = load i32, i32* %8
%14 = call i32* @gethostbyaddr(i8* %11, i64 %12, i32 %13)
%15 = icmp ne i32* %14, null
%16 = zext i1 %15 to i64
%17 = select i1 %15, i32 0, i32 1
ret i32 %17
}

LLVM IR (-O2):
@.str = [29 x i8] c"%s: Testing gethostbyaddr()\0A\00"
define i32 @_gethostbyaddr(i8* %0, i8* %1, i64 %2, i32 %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = tail call i32* @gethostbyaddr(i8* %1, i64 %2, i32 %3)
%7 = icmp eq i32* %6, null
%8 = zext i1 %7 to i32
ret i32 %8
}
void XQLength() {}


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

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

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

LLVM IR (-O2):
define void @XQLength() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double Raio, Volume, Pi = 3.14159;
  scanf("%lf", &Raio);
  Volume = ((4 / 3.0) * Pi) * (Raio * Raio * Raio);
  printf("VOLUME = %.3lf\n", Volume);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xecd(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  0xeac(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm1
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  0xeb7(%rip),%xmm0
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [16 x i8] c"VOLUME = %.3lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
store double 3.141590e+00, double* %4
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%6 = load double, double* %4
%7 = fmul double 0x3FF5555555555555, %6
%8 = load double, double* %2
%9 = load double, double* %2
%10 = fmul double %8, %9
%11 = load double, double* %2
%12 = fmul double %10, %11
%13 = fmul double %7, %12
store double %13, double* %3
%14 = load double, double* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [16 x i8] c"VOLUME = %.3lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load double, double* %1
%5 = fmul double %4, %4
%6 = fmul double %4, %5
%7 = fmul double %6, 0x4010C1514ABD0449
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %7)
ret i32 0
}
indreg0reg1_set(r0, r1, x0, x1, p0, p1) char r0, r1;
char *p0, *p1;
{ (*p0) = r1; }


x86 assembly (clang, -O0):
<indreg0reg1_set>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x6(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indreg0reg1_set>:
mov    %sil,(%r8)
ret

LLVM IR (-O0):
define i32 @indreg0reg1_set(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = trunc i32 %0 to i8
%15 = trunc i32 %1 to i8
store i8 %14, i8* %8
store i8 %15, i8* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i8* %5, i8** %13
%16 = load i8, i8* %9
%17 = load i8*, i8** %12
store i8 %16, i8* %17
%18 = load i32, i32* %7
ret i32 %18
}

LLVM IR (-O2):
define i32 @indreg0reg1_set(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture writeonly %4, i8* nocapture readnone %5) {
%7 = trunc i32 %1 to i8
store i8 %7, i8* %4
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int);
int sysinfo(void) {
  int si = sizeof(int);
  int sf = sizeof(float);
  int sd = sizeof(double);
  int sc = sizeof(char);
  int sl = sizeof(long);
  int ss = sizeof(short);
  printf("*size:\n     int:%d  short:%d  long:%d char:%d float:%d  double:%d\n",
         si, ss, sl, sc, sf, sd);
  return 0;
}


x86 assembly (clang, -O0):
<sysinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x4,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
movl   $0x8,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x8,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x8(%rbp),%r9d
mov    -0xc(%rbp),%eax
lea    0xea3(%rip),%rdi
mov    %eax,(%rsp)
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysinfo>:
push   %rax
movl   $0x8,(%rsp)
lea    0xee1(%rip),%rdi
mov    $0x4,%esi
mov    $0x2,%edx
mov    $0x8,%ecx
mov    $0x1,%r8d
mov    $0x4,%r9d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [67 x i8] c"*size:\0A int:%d short:%d long:%d char:%d float:%d double:%d\0A\00"
define i32 @sysinfo() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 4, i32* %1
store i32 4, i32* %2
store i32 8, i32* %3
store i32 1, i32* %4
store i32 8, i32* %5
store i32 2, i32* %6
%7 = load i32, i32* %1
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [67 x i8] c"*size:\0A int:%d short:%d long:%d char:%d float:%d double:%d\0A\00"
define i32 @sysinfo() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i32 4, i32 2, i32 8, i32 1, i32 4, i32 8)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t bit_reverse(uint8_t in) {
  static const uint8_t half_reverse_table[] = {0x0, 0x8, 0x4, 0xc, 0x2, 0xa,
                                               0x6, 0xe, 0x1, 0x9, 0x5, 0xd,
                                               0x3, 0xb, 0x7, 0xf};
  return half_reverse_table[in & 0xf] << 4 |
         half_reverse_table[(in & 0xf0) >> 4];
}


x86 assembly (clang, -O0):
<bit_reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0xee9(%rip),%rax
mov    (%rax,%rcx,4),%eax
shl    $0x4,%eax
mov    -0x4(%rbp),%ecx
and    $0xf0,%ecx
sar    $0x4,%ecx
movslq %ecx,%rdx
lea    0xecd(%rip),%rcx
or     (%rcx,%rdx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_reverse>:
mov    %edi,%eax
and    $0xf,%eax
lea    0xef4(%rip),%rcx
mov    (%rcx,%rax,4),%eax
shl    $0x4,%eax
shr    $0x4,%edi
and    $0xf,%edi
or     (%rcx,%rdi,4),%eax
ret

LLVM IR (-O0):
@bit_reverse.half_reverse_table = internal constant [16 x i32] [i32 0, i32 8, i32 4, i32 12, i32 2, i32 10, i32 6, i32 14, i32 1, i32 9, i32 5, i32 13, i32 3, i32 11, i32 7, i32 15]
define i32 @bit_reverse(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 15
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [16 x i32], [16 x i32]* @bit_reverse.half_reverse_table, i64 0, i64 %5
%7 = load i32, i32* %6
%8 = shl i32 %7, 4
%9 = load i32, i32* %2
%10 = and i32 %9, 240
%11 = ashr i32 %10, 4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [16 x i32], [16 x i32]* @bit_reverse.half_reverse_table, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = or i32 %8, %14
ret i32 %15
}

LLVM IR (-O2):
@bit_reverse.half_reverse_table = internal unnamed_addr constant [16 x i32] [i32 0, i32 8, i32 4, i32 12, i32 2, i32 10, i32 6, i32 14, i32 1, i32 9, i32 5, i32 13, i32 3, i32 11, i32 7, i32 15]
define i32 @bit_reverse(i32 %0) {
%2 = and i32 %0, 15
%3 = zext i32 %2 to i64
%4 = getelementptr inbounds [16 x i32], [16 x i32]* @bit_reverse.half_reverse_table, i64 0, i64 %3
%5 = load i32, i32* %4
%6 = shl i32 %5, 4
%7 = lshr i32 %0, 4
%8 = and i32 %7, 15
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [16 x i32], [16 x i32]* @bit_reverse.half_reverse_table, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = or i32 %6, %11
ret i32 %12
}
struct bwb_line *bwb_OPTION_ARITHMETIC_NATIVE(struct bwb_line *l) {
  bwx_DEBUG(__FUNCTION__);
  return bwb_zline(l);
}


x86 assembly (clang, -O0):
<bwb_OPTION_ARITHMETIC_NATIVE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <bwx_DEBUG@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <bwb_zline@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bwb_OPTION_ARITHMETIC_NATIVE>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <bwx_DEBUG@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <bwb_zline@plt>
cltq
pop    %rbx
ret

LLVM IR (-O0):
%struct.bwb_line = type opaque
@__FUNCTION__.bwb_OPTION_ARITHMETIC_NATIVE = [29 x i8] c"bwb_OPTION_ARITHMETIC_NATIVE\00"
define %struct.bwb_line* @bwb_OPTION_ARITHMETIC_NATIVE(%struct.bwb_line* %0) {
%2 = alloca %struct.bwb_line*
store %struct.bwb_line* %0, %struct.bwb_line** %2
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @bwx_DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @__FUNCTION__.bwb_OPTION_ARITHMETIC_NATIVE, i64 0, i64 0))
%4 = load %struct.bwb_line*, %struct.bwb_line** %2
%5 = call i32 (%struct.bwb_line*, ...) bitcast (i32 (...)* @bwb_zline to i32 (%struct.bwb_line*, ...)*)(%struct.bwb_line* %4)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to %struct.bwb_line*
ret %struct.bwb_line* %7
}

LLVM IR (-O2):
%struct.bwb_line = type opaque
@__FUNCTION__.bwb_OPTION_ARITHMETIC_NATIVE = [29 x i8] c"bwb_OPTION_ARITHMETIC_NATIVE\00"
define %struct.bwb_line* @bwb_OPTION_ARITHMETIC_NATIVE(%struct.bwb_line* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @bwx_DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @__FUNCTION__.bwb_OPTION_ARITHMETIC_NATIVE, i64 0, i64 0))
%3 = tail call i32 (%struct.bwb_line*, ...) bitcast (i32 (...)* @bwb_zline to i32 (%struct.bwb_line*, ...)*)(%struct.bwb_line* %0)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to %struct.bwb_line*
ret %struct.bwb_line* %5
}
void foo306(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo306(i32 %0) {
ret void
}
/* Type definitions */
struct DequeEntry {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ freeMemory(struct DequeEntry *);
extern void deque_releaseEntry(struct DequeEntry *entry) { freeMemory(entry); }


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

x86 assembly (clang, -O2):
<deque_releaseEntry>:
jmp    1030 <freeMemory@plt>

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

LLVM IR (-O2):
%struct.DequeEntry = type { i32 }
define void @deque_releaseEntry(%struct.DequeEntry* %0) {
%2 = tail call i32 @freeMemory(%struct.DequeEntry* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(void *);
void *thread_exit() {
  pthread_exit((void *)42);
  return 0;
}


x86 assembly (clang, -O0):
<thread_exit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2a,%edi
call   1030 <pthread_exit@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @thread_exit() {
%1 = call i32 @pthread_exit(i8* inttoptr (i64 42 to i8*))
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @thread_exit() {
%1 = tail call i32 @pthread_exit(i8* inttoptr (i64 42 to i8*))
ret i8* null
}
/* Type definitions */
struct ht_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct ht_node *);
void free_node(struct ht_node *node) { free(node); }


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

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

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

LLVM IR (-O2):
%struct.ht_node = type { i32 }
define void @free_node(%struct.ht_node* nocapture %0) {
%2 = tail call i32 @free(%struct.ht_node* %0)
ret void
}
/* Variables and functions */
char *qstrncpy(char *, size_t, char const *, size_t);
size_t strlen(char const *);
char *qstrcpy(char *dst, size_t size, const char *src) {
  if (dst == NULL || size == 0 || src == NULL)
    return dst;
  size_t nbytes = strlen(src);
  return qstrncpy(dst, size, src, nbytes);
}


x86 assembly (clang, -O0):
<qstrcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1155 <qstrcpy+0x35>
cmpq   $0x0,-0x18(%rbp)
je     1155 <qstrcpy+0x35>
cmpq   $0x0,-0x20(%rbp)
jne    1162 <qstrcpy+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1188 <qstrcpy+0x68>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <qstrncpy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qstrcpy>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     115b <qstrcpy+0x3b>
mov    %rsi,%r14
test   %rsi,%rsi
je     115b <qstrcpy+0x3b>
mov    %rdx,%r15
test   %rdx,%rdx
je     115b <qstrcpy+0x3b>
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %rax,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <qstrncpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @qstrcpy(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %17, label %11
11: ; preds = %3
%12 = load i64, i64* %6
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i8*, i8** %7
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %19
17: ; preds = %14, %11, %3
%18 = load i8*, i8** %5
store i8* %18, i8** %4
br label %27
19: ; preds = %14
%20 = load i8*, i8** %7
%21 = call i64 @strlen(i8* %20)
store i64 %21, i64* %8
%22 = load i8*, i8** %5
%23 = load i64, i64* %6
%24 = load i8*, i8** %7
%25 = load i64, i64* %8
%26 = call i8* @qstrncpy(i8* %22, i64 %23, i8* %24, i64 %25)
store i8* %26, i8** %4
br label %27
27: ; preds = %19, %17
%28 = load i8*, i8** %4
ret i8* %28
}

LLVM IR (-O2):
define i8* @qstrcpy(i8* %0, i64 %1, i8* %2) {
%4 = icmp eq i8* %0, null
%5 = icmp eq i64 %1, 0
%6 = or i1 %4, %5
%7 = icmp eq i8* %2, null
%8 = or i1 %6, %7
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%11 = tail call i8* @qstrncpy(i8* %0, i64 %1, i8* %2, i64 %10)
br label %12
12: ; preds = %3, %9
%13 = phi i8* [ %11, %9 ], [ %0, %3 ]
ret i8* %13
}
/* Variables and functions */
scalar_t__ isspace(int);
int /*<<< orphan*/ *strchr(char *, int);
int is_separator(int c) {
  return isspace(c) || c == '\0' || strchr(",.()+=/*=~%<>[];", c) != NULL;
}


x86 assembly (clang, -O0):
<is_separator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <isspace@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    116d <is_separator+0x4d>
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     116d <is_separator+0x4d>
mov    -0x4(%rbp),%esi
lea    0xea2(%rip),%rdi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_separator>:
push   %rbx
mov    %edi,%ebx
call   1040 <isspace@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %ebx,%ebx
je     1152 <is_separator+0x32>
test   %rcx,%rcx
jne    1152 <is_separator+0x32>
lea    0xec0(%rip),%rdi
mov    %ebx,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c",.()+=/*=~%<>[];\00"
define i32 @is_separator(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isspace(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = call i32* @strchr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = icmp ne i32* %11, null
br label %13
13: ; preds = %9, %6, %1
%14 = phi i1 [ true, %6 ], [ true, %1 ], [ %12, %9 ]
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
@.str = [17 x i8] c",.()+=/*=~%<>[];\00"
define i32 @is_separator(i32 %0) {
%2 = tail call i64 @isspace(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = icmp eq i32 %0, 0
%5 = or i1 %4, %3
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = tail call i32* @strchr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
%8 = icmp ne i32* %7, null
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %1
%11 = phi i32 [ 1, %1 ], [ %9, %6 ]
ret i32 %11
}
/* Type definitions */
struct symstr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ symstr_append_symstr(struct symstr *, struct symstr *);
struct symstr *symstr_new();
struct symstr *symstr_dup(struct symstr *ss) {
  struct symstr *new_ss;
  new_ss = symstr_new();
  symstr_append_symstr(new_ss, ss);
  return (new_ss);
}


x86 assembly (clang, -O0):
<symstr_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <symstr_new@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <symstr_append_symstr@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<symstr_dup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <symstr_new@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <symstr_append_symstr@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.symstr = type { i32 }
define %struct.symstr* @symstr_dup(%struct.symstr* %0) {
%2 = alloca %struct.symstr*
%3 = alloca %struct.symstr*
store %struct.symstr* %0, %struct.symstr** %2
%4 = call %struct.symstr* (...) @symstr_new()
store %struct.symstr* %4, %struct.symstr** %3
%5 = load %struct.symstr*, %struct.symstr** %3
%6 = load %struct.symstr*, %struct.symstr** %2
%7 = call i32 @symstr_append_symstr(%struct.symstr* %5, %struct.symstr* %6)
%8 = load %struct.symstr*, %struct.symstr** %3
ret %struct.symstr* %8
}

LLVM IR (-O2):
%struct.symstr = type { i32 }
define %struct.symstr* @symstr_dup(%struct.symstr* %0) {
%2 = tail call %struct.symstr* (...) @symstr_new()
%3 = tail call i32 @symstr_append_symstr(%struct.symstr* %2, %struct.symstr* %0)
ret %struct.symstr* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ FN_double_lock_bad(int /*<<< orphan*/ *);
void double_lock_uninit_bad() {
  pthread_mutex_t m;
  FN_double_lock_bad(&m);
}


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

x86 assembly (clang, -O2):
<double_lock_uninit_bad>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <FN_double_lock_bad@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @double_lock_uninit_bad() {
%1 = alloca i32
%2 = call i32 @FN_double_lock_bad(i32* %1)
ret void
}

LLVM IR (-O2):
define void @double_lock_uninit_bad() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @FN_double_lock_bad(i32* %1)
ret void
}
/* Variables and functions */
float __llvm_amdgcn_sin_f32(float);
float __sinf(float x) { return __llvm_amdgcn_sin_f32(x); }


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

x86 assembly (clang, -O2):
<__sinf>:
jmp    1030 <__llvm_amdgcn_sin_f32@plt>

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

LLVM IR (-O2):
define float @__sinf(float %0) {
%2 = tail call float @__llvm_amdgcn_sin_f32(float %0)
ret float %2
}
int uriwrap(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @uriwrap() {
ret i32 1
}
unsigned short ltobs(unsigned short little) {
  int c = 0;
  union {
    unsigned short big;
    char bytes[sizeof(unsigned short)];
  } swapper_big;
  union {
    char bytes[sizeof(unsigned short)];
    unsigned short little;
  } swapper_little;
  swapper_little.little = little;
  for (c = 0; c < sizeof(unsigned short); c++)
    swapper_big.bytes[c] = swapper_little.bytes[sizeof(unsigned short) - c - 1];
  return (swapper_big.big);
}


x86 assembly (clang, -O0):
<ltobs>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x2(%rbp),%ax
mov    %ax,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmp    $0x2,%rax
jae    1159 <ltobs+0x59>
movslq -0x8(%rbp),%rcx
mov    $0x2,%eax
sub    %rcx,%rax
sub    $0x1,%rax
mov    -0x18(%rbp,%rax,1),%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x10(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1121 <ltobs+0x21>
movzwl -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltobs>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
%union.anon = type { i16 }
%union.anon.0 = type { i16 }
define zeroext i16 @ltobs(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i32
%4 = alloca %union.anon
%5 = alloca %union.anon.0
store i16 %0, i16* %2
store i32 0, i32* %3
%6 = load i16, i16* %2
%7 = bitcast %union.anon.0* %5 to i16*
store i16 %6, i16* %7
store i32 0, i32* %3
br label %8
8: ; preds = %24, %1
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 2
br i1 %11, label %12, label %27
12: ; preds = %8
%13 = bitcast %union.anon.0* %5 to [2 x i8]*
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = sub i64 2, %15
%17 = sub i64 %16, 1
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %13, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = bitcast %union.anon* %4 to [2 x i8]*
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [2 x i8], [2 x i8]* %20, i64 0, i64 %22
store i8 %19, i8* %23
br label %24
24: ; preds = %12
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %8
27: ; preds = %8
%28 = bitcast %union.anon* %4 to i16*
%29 = load i16, i16* %28
ret i16 %29
}

LLVM IR (-O2):
define zeroext i16 @ltobs(i16 zeroext %0) {
%2 = call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
unsigned long gcd(unsigned long i, unsigned long j) {
  unsigned int r;
  if (i < j) {
    r = i;
    i = j;
    j = r;
  }
  while (j > 0) {
    r = i % j;
    i = j;
    j = r;
  }
  return i;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1130 <gcd+0x30>
mov    -0x8(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
mov    %rax,-0x10(%rbp)
jmp    1135 <gcd+0x35>
cmpq   $0x0,-0x10(%rbp)
jbe    1165 <gcd+0x65>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %edx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
mov    %rax,-0x10(%rbp)
jmp    1135 <gcd+0x35>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %rdi,%rax
cmp    %rsi,%rdi
mov    %eax,%edx
cmovb  %rsi,%rax
cmovae %rsi,%rdx
test   %rdx,%rdx
je     1145 <gcd+0x45>
mov    $0xffffffff,%esi
jmp    112d <gcd+0x2d>
nopl   0x0(%rax)
xor    %edx,%edx
div    %rcx
mov    %rcx,%rax
and    %rsi,%rdx
je     1142 <gcd+0x42>
mov    %rdx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1120 <gcd+0x20>
xor    %edx,%edx
div    %ecx
jmp    1125 <gcd+0x25>
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @gcd(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
%4 = and i64 %0, 4294967295
%5 = select i1 %3, i64 %1, i64 %0
%6 = select i1 %3, i64 %4, i64 %1
%7 = icmp eq i64 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %2, %8
%9 = phi i64 [ %12, %8 ], [ %6, %2 ]
%10 = phi i64 [ %9, %8 ], [ %5, %2 ]
%11 = urem i64 %10, %9
%12 = and i64 %11, 4294967295
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %8
14: ; preds = %8, %2
%15 = phi i64 [ %5, %2 ], [ %9, %8 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char, char, char, char, char, ...);
int main(void) {
  printf("A %d B %d C %d a %d b %d c %d", 'A', 'B', 'C', 'a', 'b', 'c');
  printf("0 %d 1 %d 2 %d 3 %d 4 %d 5 %d 6 %d 7 %d ", '0', '1', '2', '$', '*',
         '+', '/', ' ');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x41,%esi
mov    $0x42,%edx
mov    $0x43,%ecx
mov    $0x61,%r8d
mov    $0x62,%r9d
movl   $0x63,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
mov    $0x30,%esi
mov    $0x31,%edx
mov    $0x32,%ecx
mov    $0x24,%r8d
mov    $0x2a,%r9d
movl   $0x2b,(%rsp)
movl   $0x2f,0x8(%rsp)
movl   $0x20,0x10(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
sub    $0x8,%rsp
lea    0xee4(%rip),%rdi
mov    $0x41,%esi
mov    $0x42,%edx
mov    $0x43,%ecx
mov    $0x61,%r8d
mov    $0x62,%r9d
xor    %eax,%eax
push   $0x63
call   1030 <printf@plt>
add    $0x8,%rsp
lea    0xed3(%rip),%rdi
mov    $0x30,%esi
mov    $0x31,%edx
mov    $0x32,%ecx
mov    $0x24,%r8d
mov    $0x2a,%r9d
xor    %eax,%eax
push   $0x20
push   $0x2f
push   $0x2b
call   1030 <printf@plt>
add    $0x20,%rsp
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"A %d B %d C %d a %d b %d c %d\00"
@.str.1 = [41 x i8] c"0 %d 1 %d 2 %d 3 %d 4 %d 5 %d 6 %d 7 %d \00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, i8, i8, i8, i8, i8, i8, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8 signext 65, i8 signext 66, i8 signext 67, i8 signext 97, i8 signext 98, i8 signext 99)
%3 = call i32 (i8*, i8, i8, i8, i8, i8, i8, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8 signext 48, i8 signext 49, i8 signext 50, i8 signext 36, i8 signext 42, i8 signext 43, i32 47, i32 32)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"A %d B %d C %d a %d b %d c %d\00"
@.str.1 = [41 x i8] c"0 %d 1 %d 2 %d 3 %d 4 %d 5 %d 6 %d 7 %d \00"
define i32 @main() {
%1 = tail call i32 (i8*, i8, i8, i8, i8, i8, i8, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8 signext 65, i8 signext 66, i8 signext 67, i8 signext 97, i8 signext 98, i8 signext 99)
%2 = tail call i32 (i8*, i8, i8, i8, i8, i8, i8, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8 signext 48, i8 signext 49, i8 signext 50, i8 signext 36, i8 signext 42, i8 signext 43, i32 47, i32 32)
ret i32 0
}
int bar(int val) {
  int res = 0;
  switch (val) {
  case 1:
    res += 1;
    break;
  case 2:
    res += 2;
    break;
  default:
    break;
  }
  return res;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     1133 <bar+0x33>
jmp    1122 <bar+0x22>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1141 <bar+0x41>
jmp    114f <bar+0x4f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <bar+0x54>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <bar+0x54>
jmp    1154 <bar+0x54>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
xor    %eax,%eax
cmp    $0x2,%edi
sete   %al
add    %eax,%eax
cmp    $0x1,%edi
cmove  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @bar(i32 %0) {
%2 = icmp eq i32 %0, 2
%3 = select i1 %2, i32 2, i32 0
%4 = icmp eq i32 %0, 1
%5 = select i1 %4, i32 1, i32 %3
ret i32 %5
}
char *bridge_to_str(int bridge) {
  if (bridge)
    return "bridge";
  else
    return "non-bridge";
}


x86 assembly (clang, -O0):
<bridge_to_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1121 <bridge_to_str+0x21>
lea    0xeec(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    112c <bridge_to_str+0x2c>
lea    0xed8(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bridge_to_str>:
test   %edi,%edi
lea    0xef7(%rip),%rcx
lea    0xef4(%rip),%rax
cmove  %rcx,%rax
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"bridge\00"
@.str.1 = [11 x i8] c"non-bridge\00"
define i8* @bridge_to_str(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void **);
void prj_freelist(void **list) {
  int i = 0;
  while (list[i] != NULL)
    free(list[i++]);
  free(list);
}


x86 assembly (clang, -O0):
<prj_freelist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1156 <prj_freelist+0x46>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
jmp    1123 <prj_freelist+0x13>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prj_freelist>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1141 <prj_freelist+0x31>
lea    0x8(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <prj_freelist+0x20>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @prj_freelist(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %11, %4 ], [ %2, %1 ]
%7 = add nuw nsw i64 %5, 1
%8 = bitcast i8* %6 to i8**
%9 = tail call i32 @free(i8** %8)
%10 = getelementptr inbounds i8*, i8** %0, i64 %7
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %4
13: ; preds = %4, %1
%14 = tail call i32 @free(i8** %0)
ret void
}
void put_user_byte(char val, char *addr) { *addr = val; }


x86 assembly (clang, -O0):
<put_user_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_user_byte>:
mov    %dil,(%rsi)
ret

LLVM IR (-O0):
define void @put_user_byte(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
store i8 %0, i8* %3
store i8* %1, i8** %4
%5 = load i8, i8* %3
%6 = load i8*, i8** %4
store i8 %5, i8* %6
ret void
}

LLVM IR (-O2):
define void @put_user_byte(i8 signext %0, i8* nocapture writeonly %1) {
store i8 %0, i8* %1
ret void
}
char *strupr(string)
register char *string;
{
  register char *p = string;
  if (p) {
    while (*string) {
      if (islower(*string))
        *string = toupper(*string);
      ++string;
    }
  }
  return (p);
}


x86 assembly (clang, -O0):
<strupr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1190 <strupr+0x70>
jmp    1144 <strupr+0x24>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     118b <strupr+0x6b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <islower@plt>
cmp    $0x0,%eax
je     117a <strupr+0x5a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <toupper@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1144 <strupr+0x24>
jmp    1190 <strupr+0x70>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strupr>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
test   %rdi,%rdi
je     1165 <strupr+0x45>
mov    (%r14),%al
test   %al,%al
je     1165 <strupr+0x45>
lea    0x1(%r14),%rbx
jmp    114b <strupr+0x2b>
nopl   0x0(%rax)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1165 <strupr+0x45>
movsbl %al,%ebp
mov    %ebp,%edi
call   1030 <islower@plt>
test   %eax,%eax
je     1140 <strupr+0x20>
mov    %ebp,%edi
call   1040 <toupper@plt>
mov    %al,-0x1(%rbx)
jmp    1140 <strupr+0x20>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @strupr(i8* returned %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %19, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %19, label %6
6: ; preds = %3, %15
%7 = phi i8 [ %17, %15 ], [ %4, %3 ]
%8 = phi i8* [ %16, %15 ], [ %0, %3 ]
%9 = sext i8 %7 to i32
%10 = tail call i32 @islower(i32 %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %6
%13 = tail call i32 @toupper(i32 %9)
%14 = trunc i32 %13 to i8
store i8 %14, i8* %8
br label %15
15: ; preds = %12, %6
%16 = getelementptr inbounds i8, i8* %8, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %6
19: ; preds = %15, %3, %1
ret i8* %0
}
int foo(bar) { return bar; }


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

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

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

LLVM IR (-O2):
define i32 @foo(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
struct tempfile {
  int dummy;
};

/* Variables and functions */
int mks_tempfile_tsm(struct tempfile *, char const *, int, int);
int mks_tempfile_ts(struct tempfile *tempfile, const char *template,
                    int suffixlen) {
  return mks_tempfile_tsm(tempfile, template, suffixlen, 0600);
}


x86 assembly (clang, -O0):
<mks_tempfile_ts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x180,%ecx
call   1030 <mks_tempfile_tsm@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mks_tempfile_ts>:
mov    $0x180,%ecx
jmp    1030 <mks_tempfile_tsm@plt>

LLVM IR (-O0):
%struct.tempfile = type { i32 }
define i32 @mks_tempfile_ts(%struct.tempfile* %0, i8* %1, i32 %2) {
%4 = alloca %struct.tempfile*
%5 = alloca i8*
%6 = alloca i32
store %struct.tempfile* %0, %struct.tempfile** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load %struct.tempfile*, %struct.tempfile** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @mks_tempfile_tsm(%struct.tempfile* %7, i8* %8, i32 %9, i32 384)
ret i32 %10
}

LLVM IR (-O2):
%struct.tempfile = type { i32 }
define i32 @mks_tempfile_ts(%struct.tempfile* %0, i8* %1, i32 %2) {
%4 = tail call i32 @mks_tempfile_tsm(%struct.tempfile* %0, i8* %1, i32 %2, i32 384)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ GmfGetLin(int, int, int *);
int gmfgetsolf77_(int *MshIdx, int *kwd, int *SolTab) {
  GmfGetLin(*MshIdx, *kwd, SolTab);
  return (1);
}


x86 assembly (clang, -O0):
<gmfgetsolf77_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rdx
call   1030 <GmfGetLin@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gmfgetsolf77_>:
push   %rax
mov    (%rdi),%edi
mov    (%rsi),%esi
call   1030 <GmfGetLin@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @gmfgetsolf77_(i32* nocapture %0, i32* nocapture %1, i32* %2) {
%4 = load i32, i32* %0
%5 = load i32, i32* %1
%6 = tail call i32 @GmfGetLin(i32 %4, i32 %5, i32* %2)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ assert(int *);
int *malloc(int);
int *int2ptr(int i) {
  int *ptr = malloc(sizeof(int));
  assert(ptr);
  *ptr = i;
  return ptr;
}


x86 assembly (clang, -O0):
<int2ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int2ptr>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <assert@plt>
mov    %ebp,(%rbx)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32* @int2ptr(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i32* @malloc(i32 4)
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = call i32 @assert(i32* %5)
%7 = load i32, i32* %2
%8 = load i32*, i32** %3
store i32 %7, i32* %8
%9 = load i32*, i32** %3
ret i32* %9
}

LLVM IR (-O2):
define i32* @int2ptr(i32 %0) {
%2 = tail call i32* @malloc(i32 4)
%3 = tail call i32 @assert(i32* %2)
store i32 %0, i32* %2
ret i32* %2
}
/* Variables and functions */
short __hsign(short, short);
short intr_wrap_460(short p1, short p2) { return __hsign(p1, p2); }


x86 assembly (clang, -O0):
<intr_wrap_460>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
movswl %ax,%edi
movswl -0x4(%rbp),%esi
call   1030 <__hsign@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intr_wrap_460>:
jmp    1030 <__hsign@plt>

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

LLVM IR (-O2):
define signext i16 @intr_wrap_460(i16 signext %0, i16 signext %1) {
%3 = tail call signext i16 @__hsign(i16 signext %0, i16 signext %1)
ret i16 %3
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv, char **envp) {
  printf("Hello, world!\n");
  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)
mov    %rdx,-0x18(%rbp)
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, world!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%8 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @EXIT_SUCCESS
ret i32 %9
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [14 x i8] c"Hello, world!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}