xunge/DecIR huggingface dataset:
char test_54_0(char *mem) { return __atomic_fetch_or(mem + 0, 1, 4); }


x86 assembly (clang, -O0):
<test_54_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movb   $0x1,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    %cl,-0xc(%rbp)
mov    (%rax),%al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
mov    -0x18(%rbp),%rcx
mov    -0xc(%rbp),%sil
mov    %al,%dl
or     %sil,%dl
lock cmpxchg %dl,(%rcx)
sete   %cl
mov    %al,-0x19(%rbp)
test   $0x1,%cl
mov    %al,-0xb(%rbp)
jne    114a <test_54_0+0x4a>
jmp    111f <test_54_0+0x1f>
mov    -0x19(%rbp),%al
mov    %al,-0xa(%rbp)
movsbl -0xa(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_54_0>:
mov    (%rdi),%al
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
or     $0x1,%cl
lock cmpxchg %cl,(%rdi)
jne    1110 <test_54_0+0x10>
ret

LLVM IR (-O0):
define signext i8 @test_54_0(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 0
store i8 1, i8* %3
%7 = load i8, i8* %3
%8 = atomicrmw or i8* %6, i8 %7 acq_rel
store i8 %8, i8* %4
%9 = load i8, i8* %4
ret i8 %9
}

LLVM IR (-O2):
define signext i8 @test_54_0(i8* nocapture %0) {
%2 = atomicrmw or i8* %0, i8 1 acq_rel
ret i8 %2
}
/* Variables and functions */
int getchar();
int readChar() { return getchar(); }


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

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

LLVM IR (-O0):
define i32 @readChar() {
%1 = call i32 (...) @getchar()
ret i32 %1
}

LLVM IR (-O2):
define i32 @readChar() {
%1 = tail call i32 (...) @getchar()
ret i32 %1
}
int GetStrLen(char *GSL) {
  int RETGSL;
  for (int LoopGSL = 0; GSL[LoopGSL] != '\0';) {
    LoopGSL++;
    RETGSL = LoopGSL;
  }
  return RETGSL;
}


x86 assembly (clang, -O0):
<GetStrLen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1138 <GetStrLen+0x38>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <GetStrLen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetStrLen>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %edx,%eax
lea    0x1(%rcx),%rdx
cmpb   $0x0,(%rdi,%rcx,1)
mov    %rdx,%rcx
jne    1110 <GetStrLen+0x10>
ret

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

LLVM IR (-O2):
define i32 @GetStrLen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %8, %2 ], [ 0, %1 ]
%4 = phi i32 [ %9, %2 ], [ undef, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add nuw i64 %3, 1
%9 = trunc i64 %8 to i32
br i1 %7, label %10, label %2
10: ; preds = %2
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ bpf_error(char *);
int pfreason_to_num(const char *reason) {
  bpf_error("libpcap was compiled on a machine without pf support");
  return -1;
}


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

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

LLVM IR (-O0):
@.str = [53 x i8] c"libpcap was compiled on a machine without pf support\00"
define i32 @pfreason_to_num(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @bpf_error(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [53 x i8] c"libpcap was compiled on a machine without pf support\00"
define i32 @pfreason_to_num(i8* nocapture readnone %0) {
%2 = tail call i32 @bpf_error(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ mx_antisym(int, double *);
int /*<<< orphan*/ mx_symmultsymmx(int, double *, double *, double *);
void errormx(int M, double *R, double *F, double *D) {
  mx_symmultsymmx(M, R, F, D);
  mx_antisym(M, R);
  return;
}


x86 assembly (clang, -O0):
<errormx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <mx_symmultsymmx@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <mx_antisym@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errormx>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1030 <mx_symmultsymmx@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <mx_antisym@plt>

LLVM IR (-O0):
define void @errormx(i32 %0, double* %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
store i32 %0, i32* %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%9 = load i32, i32* %5
%10 = load double*, double** %6
%11 = load double*, double** %7
%12 = load double*, double** %8
%13 = call i32 @mx_symmultsymmx(i32 %9, double* %10, double* %11, double* %12)
%14 = load i32, i32* %5
%15 = load double*, double** %6
%16 = call i32 @mx_antisym(i32 %14, double* %15)
ret void
}

LLVM IR (-O2):
define void @errormx(i32 %0, double* %1, double* %2, double* %3) {
%5 = tail call i32 @mx_symmultsymmx(i32 %0, double* %1, double* %2, double* %3)
%6 = tail call i32 @mx_antisym(i32 %0, double* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void safe_free(void *ptr) {
  if (ptr)
    free(ptr);
}


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

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

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

LLVM IR (-O2):
define void @safe_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char *version();
main() { printf("\nMQ API version info: %s\n", version()); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <version@plt>
mov    %rax,%rsi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [26 x i8] c"\0AMQ API version info: %s\0A\00"
define i32 @main() {
%1 = call i8* (...) @version()
%2 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"\0AMQ API version info: %s\0A\00"
define i32 @main() {
%1 = tail call i8* (...) @version()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, rev = 0;
  scanf("%d", &n);
  while (n > 0) {
    rev = (rev * 10);
    rev = rev + n % 10;
    n = n / 10;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xed3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1173 <main+0x63>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%eax
add    %edx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x26>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %5
5: ; preds = %8, %0
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i32, i32* %3
%10 = mul nsw i32 %9, 10
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = srem i32 %12, 10
%14 = add nsw i32 %11, %13
store i32 %14, i32* %3
%15 = load i32, i32* %2
%16 = sdiv i32 %15, 10
store i32 %16, i32* %2
br label %5
17: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
ret i32 0
}
/* Variables and functions */
double exp(double);
double c_exp(double arg0) { return exp(arg0); }


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

x86 assembly (clang, -O2):
<c_exp>:
jmp    1030 <exp@plt>

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

LLVM IR (-O2):
define double @c_exp(double %0) {
%2 = tail call double @exp(double %0)
ret double %2
}
/* Type definitions */
typedef int /*<<< orphan*/ PKCS8_PRIV_KEY_INFO;

/* Variables and functions */
scalar_t__ ASN1_item_new(int /*<<< orphan*/ *);
int /*<<< orphan*/ PKCS8_PRIV_KEY_INFO_it;
PKCS8_PRIV_KEY_INFO *PKCS8_PRIV_KEY_INFO_new(void) {
  return (PKCS8_PRIV_KEY_INFO *)ASN1_item_new(&PKCS8_PRIV_KEY_INFO_it);
}


x86 assembly (clang, -O0):
<PKCS8_PRIV_KEY_INFO_new>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rdi
call   1030 <ASN1_item_new@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PKCS8_PRIV_KEY_INFO_new>:
mov    0x2ec9(%rip),%rdi
jmp    1030 <ASN1_item_new@plt>

LLVM IR (-O0):
@PKCS8_PRIV_KEY_INFO_it = global i32 0
define i32* @PKCS8_PRIV_KEY_INFO_new() {
%1 = call i64 @ASN1_item_new(i32* @PKCS8_PRIV_KEY_INFO_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}

LLVM IR (-O2):
@PKCS8_PRIV_KEY_INFO_it = global i32 0
define i32* @PKCS8_PRIV_KEY_INFO_new() {
%1 = tail call i64 @ASN1_item_new(i32* @PKCS8_PRIV_KEY_INFO_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}
void kfree(void *ptr) { return; }


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

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

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

LLVM IR (-O2):
define void @kfree(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ stdout;
int vfwprintf(int /*<<< orphan*/, int /*<<< orphan*/ const *,
              int /*<<< orphan*/);
int vwprintf(const wchar_t *__restrict fmt, va_list ap) {
  return (vfwprintf(stdout, fmt, ap));
}


x86 assembly (clang, -O0):
<vwprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <vfwprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vwprintf>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
jmp    1030 <vfwprintf@plt>

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

LLVM IR (-O2):
@stdout = global i32 0
define i32 @vwprintf(i32* noalias %0, i32 %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @vfwprintf(i32 %3, i32* %0, i32 %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ back(int);
int /*<<< orphan*/ forword(int);
int /*<<< orphan*/ left(int);
int /*<<< orphan*/ right(int);
void drawTree(int n) {
  if (n == 0)
    ;
  else {
    left(1);
    forword(1);
    drawTree(n - 1);
    back(n);
    right(1);
    right(1);
    forword(1);
    drawTree(n - 1);
    back(n);
    left(1);
  }
}


x86 assembly (clang, -O0):
<drawTree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    116a <drawTree+0x1a>
jmp    11cc <drawTree+0x7c>
mov    $0x1,%edi
call   1040 <left@plt>
mov    $0x1,%edi
call   1060 <forword@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1070 <drawTree@plt>
mov    -0x4(%rbp),%edi
call   1030 <back@plt>
mov    $0x1,%edi
call   1050 <right@plt>
mov    $0x1,%edi
call   1050 <right@plt>
mov    $0x1,%edi
call   1060 <forword@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1070 <drawTree@plt>
mov    -0x4(%rbp),%edi
call   1030 <back@plt>
mov    $0x1,%edi
call   1040 <left@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawTree>:
test   %edi,%edi
je     11ba <drawTree+0x6a>
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x1,%edi
call   1040 <left@plt>
mov    $0x1,%edi
call   1060 <forword@plt>
lea    -0x1(%rbx),%ebp
mov    %ebp,%edi
call   1070 <drawTree@plt>
mov    %ebx,%edi
call   1030 <back@plt>
mov    $0x1,%edi
call   1050 <right@plt>
mov    $0x1,%edi
call   1050 <right@plt>
mov    $0x1,%edi
call   1060 <forword@plt>
mov    %ebp,%edi
call   1070 <drawTree@plt>
mov    %ebx,%edi
call   1030 <back@plt>
mov    $0x1,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <left@plt>
ret

LLVM IR (-O0):
define void @drawTree(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 %6
5: ; preds = %1
br label %21
6: ; preds = %1
%7 = call i32 @left(i32 1)
%8 = call i32 @forword(i32 1)
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 1
%11 = load i32, i32* %2
%12 = call i32 @back(i32 %11)
%13 = call i32 @right(i32 1)
%14 = call i32 @right(i32 1)
%15 = call i32 @forword(i32 1)
%16 = load i32, i32* %2
%17 = sub nsw i32 %16, 1
%18 = load i32, i32* %2
%19 = call i32 @back(i32 %18)
%20 = call i32 @left(i32 1)
br label %21
21: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @drawTree(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %4
3: ; preds = %1, %4
ret void
4: ; preds = %1
%5 = tail call i32 @left(i32 1)
%6 = tail call i32 @forword(i32 1)
%7 = add nsw i32 %0, -1
tail call void @drawTree(i32 %7)
%8 = tail call i32 @back(i32 %0)
%9 = tail call i32 @right(i32 1)
%10 = tail call i32 @right(i32 1)
%11 = tail call i32 @forword(i32 1)
tail call void @drawTree(i32 %7)
%12 = tail call i32 @back(i32 %0)
%13 = tail call i32 @left(i32 1)
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ swab(void *, void *, size_t);
void byte_swap(void *packet, size_t count) { swab(packet, packet, count); }


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

x86 assembly (clang, -O2):
<byte_swap>:
mov    %rsi,%rdx
mov    %rdi,%rsi
jmp    1030 <swab@plt>

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

LLVM IR (-O2):
define void @byte_swap(i8* %0, i64 %1) {
%3 = tail call i32 @swab(i8* %0, i8* %0, i64 %1)
ret void
}
/* Variables and functions */
char *strchr1(const char *s, int c) {
  while (*s != '\0') {
    if (*s == c)
      return s;
    s++;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<strchr1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <strchr1+0x49>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1138 <strchr1+0x38>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1151 <strchr1+0x51>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110b <strchr1+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr1>:
mov    (%rdi),%cl
test   %cl,%cl
je     1123 <strchr1+0x23>
mov    %rdi,%rax
nopl   0x0(%rax)
movsbl %cl,%ecx
cmp    %esi,%ecx
je     1125 <strchr1+0x25>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr1+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr1(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %10
%6 = phi i8 [ %12, %10 ], [ %3, %2 ]
%7 = phi i8* [ %11, %10 ], [ %0, %2 ]
%8 = sext i8 %6 to i32
%9 = icmp eq i32 %8, %1
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %10, %2
%15 = phi i8* [ null, %2 ], [ null, %10 ], [ %7, %5 ]
ret i8* %15
}
int uwsgi_cr_map_use_void(struct uwsgi_corerouter *ucr,
                          struct corerouter_peer *peer) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.uwsgi_corerouter = type opaque
%struct.corerouter_peer = type opaque
define i32 @uwsgi_cr_map_use_void(%struct.uwsgi_corerouter* nocapture readnone %0, %struct.corerouter_peer* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DeinitFields();
void SwitchFrom_KCPSM3(void) { DeinitFields(); }


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

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

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

LLVM IR (-O2):
define void @SwitchFrom_KCPSM3() {
%1 = tail call i32 (...) @DeinitFields()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void Arming_messages_HelloWorld(char *loc) {
  printf("$$HelloWorld: Hello, World! (");
  printf(" @loc %s \n", loc);
  ;
}


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

x86 assembly (clang, -O2):
<Arming_messages_HelloWorld>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"$$HelloWorld: Hello, World! (\00"
@.str.1 = [11 x i8] c" @loc %s \0A\00"
define void @Arming_messages_HelloWorld(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"$$HelloWorld: Hello, World! (\00"
@.str.1 = [11 x i8] c" @loc %s \0A\00"
define void @Arming_messages_HelloWorld(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ setProcTitle(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
void worker_main() {
  setProcTitle("worker process", 0);
  sleep(10);
  exit(0);
}


x86 assembly (clang, -O0):
<worker_main>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
xor    %esi,%esi
call   1050 <setProcTitle@plt>
mov    $0xa,%edi
call   1040 <sleep@plt>
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<worker_main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %esi,%esi
call   1050 <setProcTitle@plt>
mov    $0xa,%edi
call   1040 <sleep@plt>
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"worker process\00"
define void @worker_main() {
%1 = call i32 @setProcTitle(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = call i32 @sleep(i32 10)
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [15 x i8] c"worker process\00"
define void @worker_main() {
%1 = tail call i32 @setProcTitle(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = tail call i32 @sleep(i32 10)
%3 = tail call i32 @exit(i32 0)
unreachable
}
int retirer(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @retirer() {
ret i32 0
}

LLVM IR (-O2):
define i32 @retirer() {
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int x;
};
typedef TYPE_1__ XPointerMovedEvent;

/* Variables and functions */
void set_XPointerMovedEvent_x(void *_p, int _v) {
  ((XPointerMovedEvent *)_p)->x = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XPointerMovedEvent_x>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XPointerMovedEvent_x(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XPointerMovedEvent_x(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
int drm_debugfs_crtc_add(struct drm_crtc *crtc) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.drm_crtc = type opaque
define i32 @drm_debugfs_crtc_add(%struct.drm_crtc* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_int(const unsigned int num) {
  if (num == -1U)
    printf("-1");
  else
    printf("%u", num);
}


x86 assembly (clang, -O0):
<print_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    1138 <print_int+0x28>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1149 <print_int+0x39>
mov    -0x4(%rbp),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_int>:
cmp    $0xffffffff,%edi
je     1125 <print_int+0x15>
mov    %edi,%esi
lea    0xee5(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xed4(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"-1\00"
@.str.1 = [3 x i8] c"%u\00"
define void @print_int(i32 %0) {
%2 = icmp eq i32 %0, -1
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %7
7: ; preds = %5, %3
ret void
}
int isreach_rook(int dx, int dy) { return dx == 0 || dy == 0; }


x86 assembly (clang, -O0):
<isreach_rook>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     1123 <isreach_rook+0x23>
cmpl   $0x0,-0x8(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isreach_rook>:
test   %edi,%edi
sete   %al
test   %esi,%esi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @isreach_rook(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = icmp eq i32 %1, 0
%5 = or i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ build_heap(int *);
int /*<<< orphan*/ heapify(int *, int, int /*<<< orphan*/);
int /*<<< orphan*/ swap(int *, int *);
void heap_sort(int *arr) {
  int i = 0;
  build_heap(arr);
  for (; i < 100; i++) {
    swap(&(arr[0]), &(arr[100 - i - 1]));
    heapify(arr, 100 - i - 2, 0);
  }
}


x86 assembly (clang, -O0):
<heap_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <build_heap@plt>
cmpl   $0x64,-0xc(%rbp)
jge    119b <heap_sort+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x64,%eax
sub    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
call   1050 <swap@plt>
mov    -0x8(%rbp),%rdi
mov    $0x64,%esi
sub    -0xc(%rbp),%esi
sub    $0x2,%esi
xor    %edx,%edx
call   1040 <heapify@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114c <heap_sort+0x1c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heap_sort>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <build_heap@plt>
lea    0x18c(%r14),%r15
mov    $0x64,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <swap@plt>
lea    -0x2(%rbx),%esi
mov    %r14,%rdi
xor    %edx,%edx
call   1040 <heapify@plt>
add    $0xfffffffffffffffc,%r15
add    $0xffffffffffffffff,%rbx
jne    1150 <heap_sort+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @heap_sort(i32* %0) {
%2 = tail call i32 @build_heap(i32* %0)
br label %3
3: ; preds = %1, %3
%4 = phi i64 [ 0, %1 ], [ %11, %3 ]
%5 = sub nuw nsw i64 99, %4
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = tail call i32 @swap(i32* %0, i32* %6)
%8 = trunc i64 %4 to i32
%9 = sub i32 98, %8
%10 = tail call i32 @heapify(i32* %0, i32 %9, i32 0)
%11 = add nuw nsw i64 %4, 1
%12 = icmp eq i64 %11, 100
br i1 %12, label %13, label %3
13: ; preds = %3
ret void
}
/* Variables and functions */
int lin_rsk_create(char const *);
int init_raw_socket(const char *iface) { return lin_rsk_create(iface); }


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

x86 assembly (clang, -O2):
<init_raw_socket>:
jmp    1030 <lin_rsk_create@plt>

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

LLVM IR (-O2):
define i32 @init_raw_socket(i8* %0) {
%2 = tail call i32 @lin_rsk_create(i8* %0)
ret i32 %2
}
int send_to_serial(struct fifo_buffer_t *bufaddr, char packet[180]) {
  return (0);
}


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

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

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

LLVM IR (-O2):
%struct.fifo_buffer_t = type opaque
define i32 @send_to_serial(%struct.fifo_buffer_t* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
size_t t_add(size_t, size_t, int *);
size_t t_mult(size_t a, size_t k, int *ok) {
  size_t i, s = 0;
  for (i = 0; i < k; i++) {
    s = t_add(s, a, ok);
  }
  return (s);
}


x86 assembly (clang, -O0):
<t_mult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1168 <t_mult+0x58>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <t_add@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1134 <t_mult+0x24>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_mult>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
je     1146 <t_mult+0x36>
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <t_add@plt>
add    $0xffffffffffffffff,%rbx
jne    1130 <t_mult+0x20>
jmp    1148 <t_mult+0x38>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @t_mult(i64 %0, i64 %1, i32* %2) {
%4 = icmp eq i64 %1, 0
br i1 %4, label %11, label %5
5: ; preds = %3, %5
%6 = phi i64 [ %8, %5 ], [ 0, %3 ]
%7 = phi i64 [ %9, %5 ], [ 0, %3 ]
%8 = tail call i64 @t_add(i64 %6, i64 %0, i32* %2)
%9 = add nuw i64 %7, 1
%10 = icmp eq i64 %9, %1
br i1 %10, label %11, label %5
11: ; preds = %5, %3
%12 = phi i64 [ 0, %3 ], [ %8, %5 ]
ret i64 %12
}
void outsw(int port, const void *addr, int cnt) {
  asm volatile("cld; rep outsw"
               : "=S"(addr), "=c"(cnt)
               : "d"(port), "0"(addr), "1"(cnt)
               : "cc");
}


x86 assembly (clang, -O0):
<outsw>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
cld
rep outsw %ds:(%rsi),(%dx)
mov    %rsi,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outsw>:
mov    %edx,%ecx
mov    %edi,%edx
cld
rep outsw %ds:(%rsi),(%dx)
ret

LLVM IR (-O0):
define void @outsw(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call { i8*, i32 } asm sideeffect "cld; rep outsw", "={si},={cx},{dx},0,1,~{cc},~{dirflag},~{fpsr},~{flags}"(i32 %7, i8* %8, i32 %9)
%11 = extractvalue { i8*, i32 } %10, 0
%12 = extractvalue { i8*, i32 } %10, 1
store i8* %11, i8** %5
store i32 %12, i32* %6
ret void
}

LLVM IR (-O2):
define void @outsw(i32 %0, i8* %1, i32 %2) {
%4 = tail call { i8*, i32 } asm sideeffect "cld; rep outsw", "={si},={cx},{dx},0,1,~{cc},~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* %1, i32 %2)
ret void
}
/* Variables and functions */
scalar_t__ circle_sort_rec(int *, int);
void circle_sort(int *arr, int size) {
  while (circle_sort_rec(arr, size)) {
    ;
  }
  return;
}


x86 assembly (clang, -O0):
<circle_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <circle_sort_rec@plt>
cmp    $0x0,%rax
je     113a <circle_sort+0x2a>
jmp    111f <circle_sort+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<circle_sort>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <circle_sort_rec@plt>
test   %rax,%rax
jne    1120 <circle_sort+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @circle_sort(i32* %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i64 @circle_sort_rec(i32* %0, i32 %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %3
6: ; preds = %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
scalar_t__ ntohl(int /*<<< orphan*/ const);
uint32_t EXTRACT_32BITS(const void *p) {
  return ((uint32_t)ntohl(*(const uint32_t *)(p)));
}


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

x86 assembly (clang, -O2):
<EXTRACT_32BITS>:
mov    (%rdi),%edi
jmp    1030 <ntohl@plt>

LLVM IR (-O0):
define i32 @EXTRACT_32BITS(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
%6 = call i64 @ntohl(i32 %5)
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @EXTRACT_32BITS(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i64 @ntohl(i32 %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int strlen(char *s) {
  char *t = s;
  while (*t)
    t++;
  return (int)(t - s);
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     112e <strlen+0x2e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
double distance(double, double, double, double);
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  printf("distance is %f\n", distance(1.0, 2.0, 4.0, 6.0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  0xec9(%rip),%xmm1
movsd  0xec9(%rip),%xmm2
movsd  0xec9(%rip),%xmm3
call   1040 <distance@plt>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xed7(%rip),%xmm0
movsd  0xed7(%rip),%xmm1
movsd  0xed7(%rip),%xmm2
movsd  0xed7(%rip),%xmm3
call   1040 <distance@plt>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"distance is %f\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call double @distance(double 1.000000e+00, double 2.000000e+00, double 4.000000e+00, double 6.000000e+00)
%3 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"distance is %f\0A\00"
define i32 @main() {
%1 = tail call double @distance(double 1.000000e+00, double 2.000000e+00, double 4.000000e+00, double 6.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ goodB2G();
int /*<<< orphan*/ goodG2B();
void CWE190_Integer_Overflow__char_fscanf_add_01_good() {
  goodG2B();
  goodB2G();
}


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

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

LLVM IR (-O0):
define void @CWE190_Integer_Overflow__char_fscanf_add_01_good() {
%1 = call i32 (...) @goodG2B()
%2 = call i32 (...) @goodB2G()
ret void
}

LLVM IR (-O2):
define void @CWE190_Integer_Overflow__char_fscanf_add_01_good() {
%1 = tail call i32 (...) @goodG2B()
%2 = tail call i32 (...) @goodB2G()
ret void
}
int foo(int *a, int *b, int c) {
  *a = 2 * *a;
  *b = *b / 2;
  c = *a + *b;
  return c;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
shl    $0x1,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
add    (%rcx),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
shll   (%rdi)
mov    (%rsi),%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
mov    %eax,(%rsi)
add    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @foo(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 = mul nsw i32 2, %8
%10 = load i32*, i32** %4
store i32 %9, i32* %10
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = sdiv i32 %12, 2
%14 = load i32*, i32** %5
store i32 %13, i32* %14
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = load i32*, i32** %5
%18 = load i32, i32* %17
%19 = add nsw i32 %16, %18
store i32 %19, i32* %6
%20 = load i32, i32* %6
ret i32 %20
}

LLVM IR (-O2):
define i32 @foo(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = load i32, i32* %0
%5 = shl nsw i32 %4, 1
store i32 %5, i32* %0
%6 = load i32, i32* %1
%7 = sdiv i32 %6, 2
store i32 %7, i32* %1
%8 = load i32, i32* %0
%9 = add nsw i32 %8, %7
ret i32 %9
}
int and (int paramone, int valueone, int paramtwo, int valuetwo) {
  if (paramone == valueone) {
    if (paramtwo == valuetwo) {
      return 1;
    } else if (paramtwo != valuetwo) {
      return 0;
    } else {
      return 2;
    }
  } else if (paramone != valueone) {
    return 0;
  } else {
    return 2;
  }
}


x86 assembly (clang, -O0):
<and>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1158 <and+0x58>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1134 <and+0x34>
movl   $0x1,-0x4(%rbp)
jmp    1177 <and+0x77>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     114c <and+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    1177 <and+0x77>
movl   $0x2,-0x4(%rbp)
jmp    1177 <and+0x77>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1170 <and+0x70>
movl   $0x0,-0x4(%rbp)
jmp    1177 <and+0x77>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<and>:
xor    %esi,%edi
xor    %ecx,%edx
xor    %eax,%eax
or     %edi,%edx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @and(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %0, %1
%6 = icmp eq i32 %2, %3
%7 = and i1 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
int test_imm_35int32_reg(int val) { return ((val) & (0x35 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_35int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x35,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_35int32_reg(i32 %0) {
%2 = and i32 %0, 53
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}