xunge/DecIR huggingface dataset:
/* Variables and functions */
char getchar();
int clear_input_value() {
  while (getchar() != '\n')
    ;
  return 1;
}


x86 assembly (clang, -O0):
<clear_input_value>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <clear_input_value+0x9>
mov    $0x0,%al
call   1030 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1131 <clear_input_value+0x21>
jmp    1119 <clear_input_value+0x9>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_input_value>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
jne    1120 <clear_input_value+0x10>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @clear_input_value() {
br label %1
1: ; preds = %5, %0
%2 = call signext i8 (...) @getchar()
%3 = sext i8 %2 to i32
%4 = icmp ne i32 %3, 10
br i1 %4, label %5, label %6
5: ; preds = %1
br label %1
6: ; preds = %1
ret i32 1
}

LLVM IR (-O2):
define i32 @clear_input_value() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %4, label %1
4: ; preds = %1
ret i32 1
}
int set_pallet(c_org, c_diff)
int c_org, c_diff;
{
  int retnum;
  if (c_org != 0) {
    retnum = ((15 - c_diff * 1.3) * (c_org) / 15);
    return retnum;
  }
  return 0;
}


x86 assembly (clang, -O0):
<set_pallet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     116f <set_pallet+0x6f>
cvtsi2sdl -0xc(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xed0(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xebc(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea7(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1176 <set_pallet+0x76>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_pallet>:
test   %edi,%edi
je     112d <set_pallet+0x2d>
cvtsi2sd %esi,%xmm0
mulsd  0xef0(%rip),%xmm0
movsd  0xef0(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sd %edi,%xmm2
mulsd  %xmm0,%xmm2
divsd  %xmm1,%xmm2
cvttsd2si %xmm2,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @set_pallet(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %20
9: ; preds = %2
%10 = load i32, i32* %5
%11 = sitofp i32 %10 to double
%12 = fneg double %11
%13 = call double @llvm.fmuladd.f64(double %12, double 1.300000e+00, double 1.500000e+01)
%14 = load i32, i32* %4
%15 = sitofp i32 %14 to double
%16 = fmul double %13, %15
%17 = fdiv double %16, 1.500000e+01
%18 = fptosi double %17 to i32
store i32 %18, i32* %6
%19 = load i32, i32* %6
store i32 %19, i32* %3
br label %21
20: ; preds = %2
store i32 0, i32* %3
br label %21
21: ; preds = %20, %9
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @set_pallet(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = sitofp i32 %1 to double
%6 = fneg double %5
%7 = tail call double @llvm.fmuladd.f64(double %6, double 1.300000e+00, double 1.500000e+01)
%8 = sitofp i32 %0 to double
%9 = fmul double %7, %8
%10 = fdiv double %9, 1.500000e+01
%11 = fptosi double %10 to i32
br label %12
12: ; preds = %2, %4
%13 = phi i32 [ %11, %4 ], [ 0, %2 ]
ret i32 %13
}
/* Type definitions */
struct gengetopt_args_info {
  int dummy;
};
struct cmdline_parser_params {
  int dummy;
};

/* Variables and functions */
int cmdline_parser_internal(int, char **, struct gengetopt_args_info *,
                            struct cmdline_parser_params *, int /*<<< orphan*/);
int cmdline_parser_ext(int argc, char **argv,
                       struct gengetopt_args_info *args_info,
                       struct cmdline_parser_params *params) {
  int result;
  result = cmdline_parser_internal(argc, argv, args_info, params, 0);
  return result;
}


x86 assembly (clang, -O0):
<cmdline_parser_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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
xor    %r8d,%r8d
call   1030 <cmdline_parser_internal@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdline_parser_ext>:
xor    %r8d,%r8d
jmp    1030 <cmdline_parser_internal@plt>

LLVM IR (-O0):
%struct.gengetopt_args_info = type { i32 }
%struct.cmdline_parser_params = type { i32 }
define i32 @cmdline_parser_ext(i32 %0, i8** %1, %struct.gengetopt_args_info* %2, %struct.cmdline_parser_params* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca %struct.gengetopt_args_info*
%8 = alloca %struct.cmdline_parser_params*
%9 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store %struct.gengetopt_args_info* %2, %struct.gengetopt_args_info** %7
store %struct.cmdline_parser_params* %3, %struct.cmdline_parser_params** %8
%10 = load i32, i32* %5
%11 = load i8**, i8*** %6
%12 = load %struct.gengetopt_args_info*, %struct.gengetopt_args_info** %7
%13 = load %struct.cmdline_parser_params*, %struct.cmdline_parser_params** %8
%14 = call i32 @cmdline_parser_internal(i32 %10, i8** %11, %struct.gengetopt_args_info* %12, %struct.cmdline_parser_params* %13, i32 0)
store i32 %14, i32* %9
%15 = load i32, i32* %9
ret i32 %15
}

LLVM IR (-O2):
%struct.gengetopt_args_info = type { i32 }
%struct.cmdline_parser_params = type { i32 }
define i32 @cmdline_parser_ext(i32 %0, i8** %1, %struct.gengetopt_args_info* %2, %struct.cmdline_parser_params* %3) {
%5 = tail call i32 @cmdline_parser_internal(i32 %0, i8** %1, %struct.gengetopt_args_info* %2, %struct.cmdline_parser_params* %3, i32 0)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ d();
void c(void) { d(); }


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

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

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

LLVM IR (-O2):
define void @c() {
%1 = tail call i32 (...) @d()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ NotifyBox(int, char *, char *);
void audio_monitoring_display_headphones_connected_or_not() {
  NotifyBox(2000, "Headphones %s",
            (!((*(int *)0xC0220174) & 1)) ? "connected" : "disconnected");
}


x86 assembly (clang, -O0):
<audio_monitoring_display_headphones_connected_or_not>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc0220174,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %cl
xor    $0xff,%cl
lea    0xee0(%rip),%rdx
lea    0xedc(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rdx
mov    $0x7d0,%edi
lea    0xeb8(%rip),%rsi
call   1030 <NotifyBox@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<audio_monitoring_display_headphones_connected_or_not>:
mov    $0xc0220174,%eax
testb  $0x1,(%rax)
lea    0xef2(%rip),%rax
lea    0xee8(%rip),%rdx
cmove  %rax,%rdx
lea    0xecf(%rip),%rsi
mov    $0x7d0,%edi
jmp    1030 <NotifyBox@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Headphones %s\00"
@.str.1 = [10 x i8] c"connected\00"
@.str.2 = [13 x i8] c"disconnected\00"
define void @audio_monitoring_display_headphones_connected_or_not() {
%1 = load i32, i32* inttoptr (i64 3223454068 to i32*)
%2 = and i32 %1, 1
%3 = icmp ne i32 %2, 0
%4 = xor i1 %3, true
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0)
%7 = call i32 @NotifyBox(i32 2000, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"Headphones %s\00"
@.str.1 = [10 x i8] c"connected\00"
@.str.2 = [13 x i8] c"disconnected\00"
define void @audio_monitoring_display_headphones_connected_or_not() {
%1 = load i32, i32* inttoptr (i64 3223454068 to i32*)
%2 = and i32 %1, 1
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0)
%5 = tail call i32 @NotifyBox(i32 2000, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
int find(int x, int *p) { return x == p[x] ? x : (p[x] = find(p[x], p)); }


x86 assembly (clang, -O0):
<find>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x4(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    113e <find+0x2e>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1160 <find+0x50>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x10(%rbp),%rsi
call   1030 <find@plt>
mov    -0x10(%rbp),%rcx
movslq -0x4(%rbp),%rdx
mov    %eax,(%rcx,%rdx,4)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%eax
movslq %edi,%rbx
mov    (%rsi,%rbx,4),%edi
cmp    %ebx,%edi
je     112c <find+0x1c>
mov    %rsi,%r14
call   1030 <find@plt>
mov    %eax,(%r14,%rbx,4)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @find(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 = load i32*, i32** %4
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %6, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %5, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i32, i32* %3
br label %26
14: ; preds = %2
%15 = load i32*, i32** %4
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = load i32, i32* %18
%20 = load i32*, i32** %4
%21 = call i32 @find(i32 %19, i32* %20)
%22 = load i32*, i32** %4
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
store i32 %21, i32* %25
br label %26
26: ; preds = %14, %12
%27 = phi i32 [ %13, %12 ], [ %21, %14 ]
ret i32 %27
}

LLVM IR (-O2):
define i32 @find(i32 %0, i32* nocapture %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i32, i32* %1, i64 %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, %0
br i1 %6, label %7, label %9
7: ; preds = %2, %9
%8 = phi i32 [ %10, %9 ], [ %0, %2 ]
ret i32 %8
9: ; preds = %2
%10 = tail call i32 @find(i32 %5, i32* %1)
store i32 %10, i32* %4
br label %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void ticmarker(void) {
  char *tics = "|/-\\|/-\\";
  const int numtics = 8;
  static int currtic;
  printf("\r%c", tics[currtic]);
  currtic = (currtic + 1) % numtics;
}


x86 assembly (clang, -O0):
<ticmarker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x8,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq 0x2ef7(%rip),%rcx
lea    0xecd(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1030 <printf@plt>
mov    0x2ee1(%rip),%eax
add    $0x1,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,0x2ed0(%rip)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ticmarker>:
push   %rax
mov    0x2f15(%rip),%eax
lea    0xee2(%rip),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ef8(%rip),%eax
lea    0x1(%rax),%ecx
lea    0x8(%rax),%edx
test   %ecx,%ecx
cmovns %ecx,%edx
and    $0xfffffff8,%edx
neg    %edx
add    %edx,%eax
add    $0x1,%eax
mov    %eax,0x2edd(%rip)
pop    %rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"|/-\\|/-\\\00"
@ticmarker.currtic = internal global i32 0
@.str.1 = [4 x i8] c"\0D%c\00"
define void @ticmarker() {
%1 = alloca i8*
%2 = alloca i32
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %1
store i32 8, i32* %2
%3 = load i8*, i8** %1
%4 = load i32, i32* @ticmarker.currtic
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %3, i64 %5
%7 = load i8, i8* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %7)
%9 = load i32, i32* @ticmarker.currtic
%10 = add nsw i32 %9, 1
%11 = srem i32 %10, 8
store i32 %11, i32* @ticmarker.currtic
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"|/-\\|/-\\\00"
@ticmarker.currtic = internal unnamed_addr global i32 0
@.str.1 = [4 x i8] c"\0D%c\00"
define void @ticmarker() {
%1 = load i32, i32* @ticmarker.currtic
%2 = zext i32 %1 to i64
%3 = getelementptr inbounds [9 x i8], [9 x i8]* @.str, i64 0, i64 %2
%4 = load i8, i8* %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %4)
%6 = load i32, i32* @ticmarker.currtic
%7 = add nsw i32 %6, 1
%8 = srem i32 %7, 8
store i32 %8, i32* @ticmarker.currtic
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *exec) {
  fprintf(stderr,
          "usage: %s -n <int> [ -c <int> ] [ -i <int> ] [ -t ]\n\t-n\tsize of "
          "array; strictly positive\n\t-c\tnumber of threads to execute on; "
          "defaults to serial execution; max threads equal to n\n\t-i\tloop ID "
          "for multiple executions; default to 0\n\t-t\ttest_only flag -- if "
          "set, exit after unit tests\n",
          exec);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [282 x i8] c"usage: %s -n <int> [ -c <int> ] [ -i <int> ] [ -t ]\0A\09-n\09size of array; strictly positive\0A\09-c\09number of threads to execute on; defaults to serial execution; max threads equal to n\0A\09-i\09loop ID for multiple executions; default to 0\0A\09-t\09test_only flag -- if set, exit after unit tests\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([282 x i8], [282 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [282 x i8] c"usage: %s -n <int> [ -c <int> ] [ -i <int> ] [ -t ]\0A\09-n\09size of array; strictly positive\0A\09-c\09number of threads to execute on; defaults to serial execution; max threads equal to n\0A\09-i\09loop ID for multiple executions; default to 0\0A\09-t\09test_only flag -- if set, exit after unit tests\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([282 x i8], [282 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int pledge(const char *promises, const char *execpromises) {
  (void)promises;
  (void)execpromises;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @pledge(i8* %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
ret i32 0
}

LLVM IR (-O2):
define i32 @pledge(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ read(int /*<<< orphan*/, char *, int);
int getchar() {
  static char ch[1024];
  read(0, ch, 1);
  return ch[0];
}


x86 assembly (clang, -O0):
<getchar>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0x2f23(%rip),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
movsbl 0x2f12(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getchar>:
push   %rax
lea    0x2f28(%rip),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <read@plt>
movsbl 0x2f15(%rip),%eax
pop    %rcx
ret

LLVM IR (-O0):
@getchar.ch = internal global [1024 x i8] zeroinitializer
define i32 @getchar() {
%1 = call i32 @read(i32 0, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @getchar.ch, i64 0, i64 0), i32 1)
%2 = load i8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @getchar.ch, i64 0, i64 0)
%3 = sext i8 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
@getchar.ch = internal global [1024 x i8] zeroinitializer
define i32 @getchar() {
%1 = tail call i32 @read(i32 0, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @getchar.ch, i64 0, i64 0), i32 1)
%2 = load i8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @getchar.ch, i64 0, i64 0)
%3 = sext i8 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ __inc_remove_counter();
int __unlink(char const *);
int unlink(const char *path) {
  int res = __unlink(path);
  if (res == 0)
    __inc_remove_counter();
  return res;
}


x86 assembly (clang, -O0):
<unlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <__unlink@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1149 <unlink+0x29>
mov    $0x0,%al
call   1040 <__inc_remove_counter@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unlink>:
push   %rbx
call   1030 <__unlink@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1133 <unlink+0x13>
xor    %eax,%eax
call   1040 <__inc_remove_counter@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @unlink(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @__unlink(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @__inc_remove_counter()
br label %10
10: ; preds = %8, %1
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @unlink(i8* %0) {
%2 = tail call i32 @__unlink(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @__inc_remove_counter()
br label %6
6: ; preds = %4, %1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ __coverity_free__(void *);
int /*<<< orphan*/ __coverity_panic__();
void isc__mem_putanddetach(void *mem, void *ptr, unsigned int size,
                           const char *file, unsigned int line) {
  if (!mem)
    __coverity_panic__();
  __coverity_free__(ptr);
}


x86 assembly (clang, -O0):
<isc__mem_putanddetach>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114d <isc__mem_putanddetach+0x2d>
mov    $0x0,%al
call   1030 <__coverity_panic__@plt>
mov    -0x10(%rbp),%rdi
call   1040 <__coverity_free__@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isc__mem_putanddetach>:
push   %rbx
mov    %rsi,%rbx
test   %rdi,%rdi
jne    1130 <isc__mem_putanddetach+0x10>
xor    %eax,%eax
call   1030 <__coverity_panic__@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <__coverity_free__@plt>

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

LLVM IR (-O2):
define void @isc__mem_putanddetach(i8* readnone %0, i8* %1, i32 %2, i8* nocapture readnone %3, i32 %4) {
%6 = icmp eq i8* %0, null
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 (...) @__coverity_panic__()
br label %9
9: ; preds = %7, %5
%10 = tail call i32 @__coverity_free__(i8* %1)
ret void
}
/* Type definitions */
struct xlist_t {
  int dummy;
};
struct xlist_node_t {
  int dummy;
};

/* Variables and functions */
struct xlist_node_t *_find_node_by_identifier(struct xlist_t *, int);
int _xlist_remove_node(struct xlist_t *, struct xlist_node_t *);
int xlist_remove_by_identifier(struct xlist_t *l, int identifier) {
  struct xlist_node_t *findnode = _find_node_by_identifier(l, identifier);
  return _xlist_remove_node(l, findnode);
}


x86 assembly (clang, -O0):
<xlist_remove_by_identifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <_find_node_by_identifier@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <_xlist_remove_node@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xlist_remove_by_identifier>:
push   %rbx
mov    %rdi,%rbx
call   1040 <_find_node_by_identifier@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1030 <_xlist_remove_node@plt>

LLVM IR (-O0):
%struct.xlist_t = type { i32 }
%struct.xlist_node_t = type { i32 }
define i32 @xlist_remove_by_identifier(%struct.xlist_t* %0, i32 %1) {
%3 = alloca %struct.xlist_t*
%4 = alloca i32
%5 = alloca %struct.xlist_node_t*
store %struct.xlist_t* %0, %struct.xlist_t** %3
store i32 %1, i32* %4
%6 = load %struct.xlist_t*, %struct.xlist_t** %3
%7 = load i32, i32* %4
%8 = call %struct.xlist_node_t* @_find_node_by_identifier(%struct.xlist_t* %6, i32 %7)
store %struct.xlist_node_t* %8, %struct.xlist_node_t** %5
%9 = load %struct.xlist_t*, %struct.xlist_t** %3
%10 = load %struct.xlist_node_t*, %struct.xlist_node_t** %5
%11 = call i32 @_xlist_remove_node(%struct.xlist_t* %9, %struct.xlist_node_t* %10)
ret i32 %11
}

LLVM IR (-O2):
%struct.xlist_t = type { i32 }
%struct.xlist_node_t = type { i32 }
define i32 @xlist_remove_by_identifier(%struct.xlist_t* %0, i32 %1) {
%3 = tail call %struct.xlist_node_t* @_find_node_by_identifier(%struct.xlist_t* %0, i32 %1)
%4 = tail call i32 @_xlist_remove_node(%struct.xlist_t* %0, %struct.xlist_node_t* %3)
ret i32 %4
}
A0AR1(r0, r1, x0, x1, p0, p1) unsigned short r0, r1;
unsigned short *p0, *p1;
{
  if ((*((unsigned short *)10000000)) <= (p1[1111111 / 4]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<A0AR1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    $0x989680,%eax
movzwl (%rax),%eax
mov    -0x20(%rbp),%rcx
movzwl 0x87a22(%rcx),%ecx
cmp    %ecx,%eax
jg     1146 <A0AR1+0x46>
movl   $0x1,-0x4(%rbp)
jmp    114d <A0AR1+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<A0AR1>:
movzwl 0x989680,%ecx
xor    %eax,%eax
cmp    0x87a22(%r9),%cx
setbe  %al
ret

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

LLVM IR (-O2):
define i32 @A0AR1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture readnone %4, i16* nocapture %5) {
%7 = load i16, i16* inttoptr (i64 10000000 to i16*)
%8 = getelementptr inbounds i16, i16* %5, i64 277777
%9 = load i16, i16* %8
%10 = icmp ule i16 %7, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ interchange(int *, int *);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int x = 5, y = 10;
  printf("Originally x = %d and y = %d.\n", x, y);
  interchange(&x, &y);
  printf("Now x = %d and y = %d.\n", x, y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <interchange@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x5,0x4(%rsp)
movl   $0xa,(%rsp)
lea    0xec9(%rip),%rdi
mov    $0x5,%esi
mov    $0xa,%edx
call   1030 <printf@plt>
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <interchange@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Originally x = %d and y = %d.\0A\00"
@.str.1 = [24 x i8] c"Now x = %d and y = %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
store i32 10, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
%7 = call i32 @interchange(i32* %2, i32* %3)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Originally x = %d and y = %d.\0A\00"
@.str.1 = [24 x i8] c"Now x = %d and y = %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 10, i32* %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 5, i32 10)
%6 = call i32 @interchange(i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cc3000_is_ready();
void cc3000_wait(void) {
  while (!cc3000_is_ready()) {
  }
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
jmp    1119 <cc3000_wait+0x9>
mov    $0x0,%al
call   1030 <cc3000_is_ready@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1135 <cc3000_wait+0x25>
jmp    113a <cc3000_wait+0x2a>
jmp    1119 <cc3000_wait+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <cc3000_is_ready@plt>
test   %eax,%eax
je     1120 <cc3000_wait+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @cc3000_wait() {
br label %1
1: ; preds = %5, %0
%2 = call i32 (...) @cc3000_is_ready()
%3 = icmp ne i32 %2, 0
%4 = xor i1 %3, true
br i1 %4, label %5, label %6
5: ; preds = %1
br label %1
6: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @cc3000_wait() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @cc3000_is_ready()
%3 = icmp eq i32 %2, 0
br i1 %3, label %1, label %4
4: ; preds = %1
ret void
}
double ls_cost_nm5_sign(double x) { return x < 0 ? -1 : x > 0 ? 1 : x; }


x86 assembly (clang, -O0):
<ls_cost_nm5_sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1129 <ls_cost_nm5_sign+0x29>
movsd  0xee9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1161 <ls_cost_nm5_sign+0x61>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    114d <ls_cost_nm5_sign+0x4d>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1157 <ls_cost_nm5_sign+0x57>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_cost_nm5_sign>:
xorpd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm0,%xmm2
movsd  0xeeb(%rip),%xmm3
andpd  %xmm2,%xmm3
andnpd %xmm0,%xmm2
orpd   %xmm3,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm1
andnpd %xmm2,%xmm1
movsd  0xed2(%rip),%xmm2
andpd  %xmm2,%xmm0
orpd   %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @ls_cost_nm5_sign(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fcmp ogt double %0, 0.000000e+00
%4 = select i1 %3, double 1.000000e+00, double %0
%5 = select i1 %2, double -1.000000e+00, double %4
ret double %5
}
/* Variables and functions */
int get_master_slave_ptmx(int *, int *);
int get_master_slave_pty(int *, int *);
int get_master_slave(int *master, int *slave) {
  int r;
  r = get_master_slave_ptmx(master, slave);
  if (r < 0)
    r = get_master_slave_pty(master, slave);
  return r;
}


x86 assembly (clang, -O0):
<get_master_slave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <get_master_slave_ptmx@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    115a <get_master_slave+0x3a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <get_master_slave_pty@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_master_slave>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <get_master_slave_ptmx@plt>
test   %eax,%eax
js     113b <get_master_slave+0x1b>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <get_master_slave_pty@plt>

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

LLVM IR (-O2):
define i32 @get_master_slave(i32* %0, i32* %1) {
%3 = tail call i32 @get_master_slave_ptmx(i32* %0, i32* %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @get_master_slave_pty(i32* %0, i32* %1)
br label %7
7: ; preds = %5, %2
%8 = phi i32 [ %6, %5 ], [ %3, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, char const *, size_t);
int strlen(char const *);
void cb_get_kv(const void *kv, void *value, size_t len) {
  const char *key = (const char *)kv;
  size_t keylen = strlen(key) + 1;
  memcpy(value, key + keylen, len);
}


x86 assembly (clang, -O0):
<cb_get_kv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
add    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cb_get_kv>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
lea    (%rax,%rbx,1),%rsi
add    $0x1,%rsi
mov    %r15,%rdi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <memcpy@plt>

LLVM IR (-O0):
define void @cb_get_kv(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%9 = load i8*, i8** %4
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = call i32 @strlen(i8* %10)
%12 = add nsw i32 %11, 1
%13 = sext i32 %12 to i64
store i64 %13, i64* %8
%14 = load i8*, i8** %5
%15 = load i8*, i8** %7
%16 = load i64, i64* %8
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = load i64, i64* %6
%19 = call i32 @memcpy(i8* %14, i8* %17, i64 %18)
ret void
}

LLVM IR (-O2):
define void @cb_get_kv(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = tail call i32 @memcpy(i8* %1, i8* %7, i64 %2)
ret void
}
/* Variables and functions */
scalar_t__ alloca(int);
int /*<<< orphan*/ memcpy(int *, int *, int);
int /*<<< orphan*/ printf(char *, int);
void CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_01_bad() {
  int *data;
  data = NULL;
  data = (int *)alloca(10);
  {
    int source[10] = {0};
    memcpy(data, source, 10 * sizeof(int));
    printf("%d\n", data[0]);
  }
}


x86 assembly (clang, -O0):
<CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_01_bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0xa,%edi
call   1050 <alloca@plt>
mov    %rax,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_01_bad>:
push   %rbx
sub    $0x30,%rsp
mov    $0xa,%edi
call   1040 <alloca@plt>
mov    %rax,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x20(%rsp)
mov    %rsp,%rsi
mov    %rax,%rdi
mov    $0x28,%edx
call   1050 <memcpy@plt>
mov    (%rbx),%esi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_01_bad() {
%1 = alloca i32*
%2 = alloca [10 x i32]
store i32* null, i32** %1
%3 = call i64 @alloca(i32 10)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %1
%5 = bitcast [10 x i32]* %2 to i8*
%6 = load i32*, i32** %1
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%8 = call i32 @memcpy(i32* %6, i32* %7, i32 40)
%9 = load i32*, i32** %1
%10 = getelementptr inbounds i32, i32* %9, i64 0
%11 = load i32, i32* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_01_bad() {
%1 = alloca [10 x i32]
%2 = tail call i64 @alloca(i32 10)
%3 = inttoptr i64 %2 to i32*
%4 = bitcast [10 x i32]* %1 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%6 = call i32 @memcpy(i32* %3, i32* %5, i32 40)
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int FindAdressData(uint32_t address) {
  int a, result;
  a = address;
  result = a / 4;
  return result;
}


x86 assembly (clang, -O0):
<FindAdressData>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FindAdressData>:
lea    0x3(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x2,%eax
ret

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

LLVM IR (-O2):
define i32 @FindAdressData(i32 %0) {
%2 = sdiv i32 %0, 4
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ acc_copyin(int *, int);
int main(int argc, char *argv[]) {
  int i;
#pragma acc data present_or_copy(i)
  acc_copyin(&i, sizeof i);
  return 0;
}


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)
lea    -0x14(%rbp),%rdi
mov    $0x4,%esi
call   1030 <acc_copyin@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @acc_copyin(i32* %6, i32 4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @acc_copyin(i32* %3, i32 4)
ret i32 0
}
void treset(int nt, int nr) {}


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

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

LLVM IR (-O0):
define void @treset(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @treset(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __u8;
typedef int /*<<< orphan*/ __u32;

/* Variables and functions */
int /*<<< orphan*/ __get_unaligned_le32(int /*<<< orphan*/ const *);
__u32 get_unaligned_le32(const void *p) {
  return __get_unaligned_le32((const __u8 *)p);
}


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

x86 assembly (clang, -O2):
<get_unaligned_le32>:
jmp    1030 <__get_unaligned_le32@plt>

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

LLVM IR (-O2):
define i32 @get_unaligned_le32(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @__get_unaligned_le32(i32* %2)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int syscall(int, int, int /*<<< orphan*/, size_t, int);
int shmget(key_t key, size_t size, int flag) {
  return syscall(117, 23, key, size, flag);
}


x86 assembly (clang, -O0):
<shmget>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    $0x75,%edi
mov    $0x17,%esi
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shmget>:
mov    %edx,%r8d
mov    %rsi,%rcx
mov    %edi,%edx
mov    $0x75,%edi
mov    $0x17,%esi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @shmget(i32 %0, i64 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
store i32 %0, i32* %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i64, i64* %5
%9 = load i32, i32* %6
%10 = call i32 @syscall(i32 117, i32 23, i32 %7, i64 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @shmget(i32 %0, i64 %1, i32 %2) {
%4 = tail call i32 @syscall(i32 117, i32 23, i32 %0, i64 %1, i32 %2)
ret i32 %4
}
void INT_Excep_FCU_FCUERR(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_FCU_FCUERR() {
ret void
}
/* Variables and functions */
int ctoi(unsigned char const);
void c16k_set_c(const unsigned char source_a, unsigned char source_b,
                unsigned int values[], unsigned int *bar_chars) {
  int weight;
  weight = (10 * ctoi(source_a)) + ctoi(source_b);
  values[(*bar_chars)] = weight;
  (*bar_chars)++;
}


x86 assembly (clang, -O0):
<c16k_set_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <ctoi@plt>
imul   $0xa,%eax,%eax
mov    %eax,-0x20(%rbp)
movzbl -0x2(%rbp),%edi
call   1030 <ctoi@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c16k_set_c>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %esi,%r15d
call   1030 <ctoi@plt>
lea    (%rax,%rax,4),%ebp
mov    %r15d,%edi
call   1030 <ctoi@plt>
lea    (%rax,%rbp,2),%eax
mov    (%rbx),%ecx
mov    %eax,(%r14,%rcx,4)
addl   $0x1,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @c16k_set_c(i8 zeroext %0, i8 zeroext %1, i32* %2, i32* %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store i8 %0, i8* %5
store i8 %1, i8* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%10 = load i8, i8* %5
%11 = call i32 @ctoi(i8 zeroext %10)
%12 = mul nsw i32 10, %11
%13 = load i8, i8* %6
%14 = call i32 @ctoi(i8 zeroext %13)
%15 = add nsw i32 %12, %14
store i32 %15, i32* %9
%16 = load i32, i32* %9
%17 = load i32*, i32** %7
%18 = load i32*, i32** %8
%19 = load i32, i32* %18
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %17, i64 %20
store i32 %16, i32* %21
%22 = load i32*, i32** %8
%23 = load i32, i32* %22
%24 = add i32 %23, 1
store i32 %24, i32* %22
ret void
}

LLVM IR (-O2):
define void @c16k_set_c(i8 zeroext %0, i8 zeroext %1, i32* nocapture writeonly %2, i32* nocapture %3) {
%5 = tail call i32 @ctoi(i8 zeroext %0)
%6 = mul nsw i32 %5, 10
%7 = tail call i32 @ctoi(i8 zeroext %1)
%8 = add nsw i32 %6, %7
%9 = load i32, i32* %3
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %2, i64 %10
store i32 %8, i32* %11
%12 = load i32, i32* %3
%13 = add i32 %12, 1
store i32 %13, i32* %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ max_1(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ min_1(int /*<<< orphan*/, int /*<<< orphan*/);
int32_t clamp_0(int32_t x_3, int32_t down_0, int32_t up_0) {
  int32_t norm_154 = down_0;
  int32_t norm_153 = min_1(x_3, up_0);
  int32_t norm_155 = norm_153;
  return max_1(norm_154, norm_155);
}


x86 assembly (clang, -O0):
<clamp_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <min_1@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <max_1@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp_0>:
push   %rbx
mov    %esi,%ebx
mov    %edx,%esi
call   1040 <min_1@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1030 <max_1@plt>

LLVM IR (-O0):
define i32 @clamp_0(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %5
store i32 %10, i32* %7
%11 = load i32, i32* %4
%12 = load i32, i32* %6
%13 = call i32 @min_1(i32 %11, i32 %12)
store i32 %13, i32* %8
%14 = load i32, i32* %8
store i32 %14, i32* %9
%15 = load i32, i32* %7
%16 = load i32, i32* %9
%17 = call i32 @max_1(i32 %15, i32 %16)
ret i32 %17
}

LLVM IR (-O2):
define i32 @clamp_0(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @min_1(i32 %0, i32 %2)
%5 = tail call i32 @max_1(i32 %1, i32 %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printbits(int n) {
  if (n > 0) {
    printf("%d", n % 2);
    printbits(n / 2);
  }
}


x86 assembly (clang, -O0):
<printbits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1160 <printbits+0x40>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <printbits@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printbits>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    1146 <printbits+0x36>
mov    %edi,%ebx
lea    0xedf(%rip),%r14
mov    %edi,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%esi
and    $0x1,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
shr    %ebp
cmp    $0x1,%ebx
mov    %ebp,%ebx
ja     1130 <printbits+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @printbits(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ %0, %1 ]
%5 = and i32 %4, 1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = lshr i32 %4, 1
%8 = icmp ult i32 %4, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int type;
};
struct TYPE_4__ {
  TYPE_1__ xvisibility;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xvisibility_type(void *_p, int _v) {
  ((XEvent *)_p)->xvisibility.type = (int)_v;
}


x86 assembly (clang, -O0):
<set_XEvent_xvisibility_type>:
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_XEvent_xvisibility_type>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xvisibility_type(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_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xvisibility_type(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
void coll_nop_unduper(void *item, const void *xtra) {}


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

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

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

LLVM IR (-O2):
define void @coll_nop_unduper(i8* nocapture %0, i8* nocapture %1) {
ret void
}