xunge/DecIR huggingface dataset:
/* Variables and functions */
float Window(float const, float const, float);
float sin(double);
float OEPulse(float t) {
  const float kDuration = 0.12f;
  return sin(2.0 * 3.14159265358979324 * 300.0 * t) *
         Window(kDuration, kDuration / 2, t);
}


x86 assembly (clang, -O0):
<OEPulse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xecb(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xebd(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm2
movss  0xe9a(%rip),%xmm0
movss  0xe96(%rip),%xmm1
call   1030 <Window@plt>
movaps %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
mulss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OEPulse>:
push   %rax
movss  %xmm0,0x4(%rsp)
cvtss2sd %xmm0,%xmm0
mulsd  0xecd(%rip),%xmm0
call   1040 <sin@plt>
movss  %xmm0,(%rsp)
movss  0xec3(%rip),%xmm0
movss  0xebf(%rip),%xmm1
movss  0x4(%rsp),%xmm2
call   1030 <Window@plt>
mulss  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @OEPulse(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
store float 0x3FBEB851E0000000, float* %3
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = fmul double 0x409D73D286BFE4D8, %5
%7 = call float @sin(double %6)
%8 = load float, float* %2
%9 = call float @Window(float 0x3FBEB851E0000000, float 0x3FAEB851E0000000, float %8)
%10 = fmul float %7, %9
ret float %10
}

LLVM IR (-O2):
define float @OEPulse(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 0x409D73D286BFE4D8
%4 = tail call float @sin(double %3)
%5 = tail call float @Window(float 0x3FBEB851E0000000, float 0x3FAEB851E0000000, float %0)
%6 = fmul float %4, %5
ret float %6
}
/* Variables and functions */
int rom_present(char *);
int sb_awe32_available() { return rom_present("awe32.raw"); }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"awe32.raw\00"
define i32 @sb_awe32_available() {
%1 = call i32 @rom_present(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [10 x i8] c"awe32.raw\00"
define i32 @sb_awe32_available() {
%1 = tail call i32 @rom_present(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Type definitions */
struct hufftables_icf {
  int dummy;
};
struct deflate_icf {
  int dummy;
};
struct BitBuf2 {
  int dummy;
};

/* Variables and functions */
struct deflate_icf *encode_deflate_icf_base(struct deflate_icf *,
                                            struct deflate_icf *,
                                            struct BitBuf2 *,
                                            struct hufftables_icf *);
struct deflate_icf *encode_deflate_icf(struct deflate_icf *next_in,
                                       struct deflate_icf *end_in,
                                       struct BitBuf2 *bb,
                                       struct hufftables_icf *hufftables) {
  return encode_deflate_icf_base(next_in, end_in, bb, hufftables);
}


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

x86 assembly (clang, -O2):
<encode_deflate_icf>:
jmp    1030 <encode_deflate_icf_base@plt>

LLVM IR (-O0):
%struct.deflate_icf = type { i32 }
%struct.BitBuf2 = type { i32 }
%struct.hufftables_icf = type { i32 }
define %struct.deflate_icf* @encode_deflate_icf(%struct.deflate_icf* %0, %struct.deflate_icf* %1, %struct.BitBuf2* %2, %struct.hufftables_icf* %3) {
%5 = alloca %struct.deflate_icf*
%6 = alloca %struct.deflate_icf*
%7 = alloca %struct.BitBuf2*
%8 = alloca %struct.hufftables_icf*
store %struct.deflate_icf* %0, %struct.deflate_icf** %5
store %struct.deflate_icf* %1, %struct.deflate_icf** %6
store %struct.BitBuf2* %2, %struct.BitBuf2** %7
store %struct.hufftables_icf* %3, %struct.hufftables_icf** %8
%9 = load %struct.deflate_icf*, %struct.deflate_icf** %5
%10 = load %struct.deflate_icf*, %struct.deflate_icf** %6
%11 = load %struct.BitBuf2*, %struct.BitBuf2** %7
%12 = load %struct.hufftables_icf*, %struct.hufftables_icf** %8
%13 = call %struct.deflate_icf* @encode_deflate_icf_base(%struct.deflate_icf* %9, %struct.deflate_icf* %10, %struct.BitBuf2* %11, %struct.hufftables_icf* %12)
ret %struct.deflate_icf* %13
}

LLVM IR (-O2):
%struct.deflate_icf = type { i32 }
%struct.BitBuf2 = type { i32 }
%struct.hufftables_icf = type { i32 }
define %struct.deflate_icf* @encode_deflate_icf(%struct.deflate_icf* %0, %struct.deflate_icf* %1, %struct.BitBuf2* %2, %struct.hufftables_icf* %3) {
%5 = tail call %struct.deflate_icf* @encode_deflate_icf_base(%struct.deflate_icf* %0, %struct.deflate_icf* %1, %struct.BitBuf2* %2, %struct.hufftables_icf* %3)
ret %struct.deflate_icf* %5
}
void symbol24_32(void) {}


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

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

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

LLVM IR (-O2):
define void @symbol24_32() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ emsSetd(char const *, double);
void msgSetd(const char *token, double dvalue) { emsSetd(token, dvalue); }


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

x86 assembly (clang, -O2):
<msgSetd>:
jmp    1030 <emsSetd@plt>

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

LLVM IR (-O2):
define void @msgSetd(i8* %0, double %1) {
%3 = tail call i32 @emsSetd(i8* %0, double %1)
ret void
}
/* Variables and functions */
scalar_t__ _ascii85_open_tonemap(char const *);
void *ascii85_open_tonemap(const char *outfile) {
  return (void *)_ascii85_open_tonemap(outfile);
}


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

x86 assembly (clang, -O2):
<ascii85_open_tonemap>:
jmp    1030 <_ascii85_open_tonemap@plt>

LLVM IR (-O0):
define i8* @ascii85_open_tonemap(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @_ascii85_open_tonemap(i8* %3)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}

LLVM IR (-O2):
define i8* @ascii85_open_tonemap(i8* %0) {
%2 = tail call i64 @_ascii85_open_tonemap(i8* %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void errhandle(char *msg) {
  perror(msg);
  exit(1);
}


x86 assembly (clang, -O0):
<errhandle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<errhandle>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @errhandle(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @errhandle(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int omap_rev();
int is_omap16xx(void) { return ((omap_rev() & 0xff) == (0x16)) ? 1 : 0; }


x86 assembly (clang, -O0):
<is_omap16xx>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <omap_rev@plt>
mov    %eax,%edx
and    $0xff,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x16,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_omap16xx>:
push   %rax
xor    %eax,%eax
call   1030 <omap_rev@plt>
xor    %ecx,%ecx
cmp    $0x16,%al
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_omap16xx() {
%1 = call i32 (...) @omap_rev()
%2 = and i32 %1, 255
%3 = icmp eq i32 %2, 22
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 1, i32 0
ret i32 %5
}

LLVM IR (-O2):
define i32 @is_omap16xx() {
%1 = tail call i32 (...) @omap_rev()
%2 = and i32 %1, 255
%3 = icmp eq i32 %2, 22
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void error(char *msg) {
  fprintf(stderr, "%s\n", msg);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

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

/* Variables and functions */
int fn_is_fake_mcount32(Elf32_Rel const *rp) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @fn_is_fake_mcount32(i32* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ netplot(char *, int, int, int);
void netplot_defaults() { netplot("127.0.0.1", 9600, 100, 1); }


x86 assembly (clang, -O0):
<netplot_defaults>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x2580,%esi
mov    $0x64,%edx
mov    $0x1,%ecx
call   1030 <netplot@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<netplot_defaults>:
lea    0xee9(%rip),%rdi
mov    $0x2580,%esi
mov    $0x64,%edx
mov    $0x1,%ecx
jmp    1030 <netplot@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"127.0.0.1\00"
define void @netplot_defaults() {
%1 = call i32 @netplot(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 9600, i32 100, i32 1)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"127.0.0.1\00"
define void @netplot_defaults() {
%1 = tail call i32 @netplot(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 9600, i32 100, i32 1)
ret void
}
int func1() { return 23; }


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

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

LLVM IR (-O0):
define i32 @func1() {
ret i32 23
}

LLVM IR (-O2):
define i32 @func1() {
ret i32 23
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
void do_nothing(int sig) { fprintf(stderr, "Got nothing-signal %d\n", sig); }


x86 assembly (clang, -O0):
<do_nothing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xed2(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_nothing>:
mov    %edi,%edx
mov    0x2ec7(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"Got nothing-signal %d\0A\00"
define void @do_nothing(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int, int);
void exitfunc20(int status, void *arg) {
  printf("Executing exitfunc20 (status=%d, arg=%d)\n", status, (int)arg);
  exit((int)arg);
}


x86 assembly (clang, -O0):
<exitfunc20>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    %eax,%edx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exitfunc20>:
push   %rbx
mov    %rsi,%rbx
mov    %edi,%esi
lea    0xed3(%rip),%rdi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"Executing exitfunc20 (status=%d, arg=%d)\0A\00"
define void @exitfunc20(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = ptrtoint i8* %6 to i32
%8 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i32
%11 = call i32 @exit(i32 %10)
unreachable
}

LLVM IR (-O2):
@.str = [42 x i8] c"Executing exitfunc20 (status=%d, arg=%d)\0A\00"
define void @exitfunc20(i32 %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %4)
%6 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int, int, int);
void validateInput(int n) {
  char good = 1;
  if (1 > n || 1000000 < n) {
    good = 0;
  }
  if (!good) {
    printf("Input out of bounds: was %d; has to be between %d and"
           "%d.",
           1, 1000000, n);
    exit(2);
  }
}


x86 assembly (clang, -O0):
<validateInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x1,-0x5(%rbp)
mov    $0x1,%eax
cmp    -0x4(%rbp),%eax
jg     114b <validateInput+0x2b>
mov    $0xf4240,%eax
cmp    -0x4(%rbp),%eax
jge    114f <validateInput+0x2f>
movb   $0x0,-0x5(%rbp)
cmpb   $0x0,-0x5(%rbp)
jne    117c <validateInput+0x5c>
mov    -0x4(%rbp),%ecx
lea    0xe9d(%rip),%rdi
mov    $0x1,%esi
mov    $0xf4240,%edx
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validateInput>:
mov    %edi,%ecx
lea    -0x1(%rcx),%eax
cmp    $0xf4240,%eax
jae    112d <validateInput+0xd>
ret
push   %rax
lea    0xecb(%rip),%rdi
mov    $0x1,%esi
mov    $0xf4240,%edx
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [57 x i8] c"Input out of bounds: was %d; has to be between %d and%d.\00"
define void @validateInput(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
store i8 1, i8* %3
%4 = load i32, i32* %2
%5 = icmp sgt i32 1, %4
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp slt i32 1000000, %7
br i1 %8, label %9, label %10
9: ; preds = %6, %1
store i8 0, i8* %3
br label %10
10: ; preds = %9, %6
%11 = load i8, i8* %3
%12 = icmp ne i8 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %10
%14 = load i32, i32* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 1, i32 1000000, i32 %14)
%16 = call i32 @exit(i32 2)
unreachable
17: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [57 x i8] c"Input out of bounds: was %d; has to be between %d and%d.\00"
define void @validateInput(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 1000000
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 1, i32 1000000, i32 %0)
%6 = tail call i32 @exit(i32 2)
unreachable
7: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ memcpy(int *, int *, int);
void test_memcpy() {
  int dest = 0;
  int src = 1;
  memcpy(&dest, &src, sizeof(int));
  assert(dest == 0);
  assert(src == 1);
}


x86 assembly (clang, -O0):
<test_memcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
cmpl   $0x0,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x1,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_memcpy>:
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x1,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
xor    %edi,%edi
cmpl   $0x0,0x4(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x1,(%rsp)
sete   %dil
call   1030 <assert@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @test_memcpy() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%3 = call i32 @memcpy(i32* %1, i32* %2, i32 4)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
ret void
}

LLVM IR (-O2):
define void @test_memcpy() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%5 = call i32 @memcpy(i32* %1, i32* %2, i32 4)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
ret void
}
double dbl_cmp_eq(double a, double b, double c, double d) {
  return (a == b) ? c : d;
}


x86 assembly (clang, -O0):
<dbl_cmp_eq>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    113d <dbl_cmp_eq+0x3d>
jp     113d <dbl_cmp_eq+0x3d>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1147 <dbl_cmp_eq+0x47>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbl_cmp_eq>:
cmpeqsd %xmm1,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm3,%xmm0
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @dbl_cmp_eq(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %5
%10 = load double, double* %6
%11 = fcmp oeq double %9, %10
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = load double, double* %7
br label %16
14: ; preds = %4
%15 = load double, double* %8
br label %16
16: ; preds = %14, %12
%17 = phi double [ %13, %12 ], [ %15, %14 ]
ret double %17
}

LLVM IR (-O2):
define double @dbl_cmp_eq(double %0, double %1, double %2, double %3) {
%5 = fcmp oeq double %0, %1
%6 = select i1 %5, double %2, double %3
ret double %6
}
void do_error(char *error) {}


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

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

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

LLVM IR (-O2):
define void @do_error(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int yaffs_dump_dev_reldir(int /*<<< orphan*/, char const *);
int yaffs_dump_dev(const char *path) {
  return yaffs_dump_dev_reldir((0), path);
}


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

x86 assembly (clang, -O2):
<yaffs_dump_dev>:
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <yaffs_dump_dev_reldir@plt>

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

LLVM IR (-O2):
define i32 @yaffs_dump_dev(i8* %0) {
%2 = tail call i32 @yaffs_dump_dev_reldir(i32 0, i8* %0)
ret i32 %2
}
void kobject_unregister(struct kobject *x) { return; }


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

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

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

LLVM IR (-O2):
%struct.kobject = type opaque
define void @kobject_unregister(%struct.kobject* nocapture %0) {
ret void
}
IR0I1(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{
  if ((*p0) <= 33)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<IR0I1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmpl   $0x21,(%rax)
jg     1131 <IR0I1+0x31>
movl   $0x1,-0x4(%rbp)
jmp    1138 <IR0I1+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IR0I1>:
xor    %eax,%eax
cmpl   $0x22,(%r8)
setl   %al
ret

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

LLVM IR (-O2):
define i32 @IR0I1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4, i32* nocapture readnone %5) {
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 34
%9 = zext i1 %8 to i32
ret i32 %9
}
void main(void) {
  gdt_install();
  idt_install();
  isrs_install();
  irq_install();
  timer_install();
  keyboard_install();
  mouse_install();
  __asm__ __volatile__("sti");
  clear_keyboard_buffers();
  clear(0x0, 0x0);
  dirreen();
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <gdt_install@plt>
mov    $0x0,%al
call   1070 <idt_install@plt>
mov    $0x0,%al
call   1080 <isrs_install@plt>
mov    $0x0,%al
call   1040 <irq_install@plt>
mov    $0x0,%al
call   1030 <timer_install@plt>
mov    $0x0,%al
call   10b0 <keyboard_install@plt>
mov    $0x0,%al
call   1050 <mouse_install@plt>
sti
mov    $0x0,%al
call   10a0 <clear_keyboard_buffers@plt>
xor    %esi,%esi
mov    %esi,%edi
mov    $0x0,%al
call   10c0 <clear@plt>
mov    $0x0,%al
call   1090 <dirreen@plt>
jmp    11ef <main+0x4f>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <gdt_install@plt>
xor    %eax,%eax
call   1070 <idt_install@plt>
xor    %eax,%eax
call   1080 <isrs_install@plt>
xor    %eax,%eax
call   1040 <irq_install@plt>
xor    %eax,%eax
call   1030 <timer_install@plt>
xor    %eax,%eax
call   10b0 <keyboard_install@plt>
xor    %eax,%eax
call   1050 <mouse_install@plt>
sti
xor    %eax,%eax
call   10a0 <clear_keyboard_buffers@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %eax,%eax
call   10c0 <clear@plt>
xor    %eax,%eax
call   1090 <dirreen@plt>
nopl   0x0(%rax)
jmp    11f0 <main+0x50>

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @gdt_install()
%2 = call i32 (...) @idt_install()
%3 = call i32 (...) @isrs_install()
%4 = call i32 (...) @irq_install()
%5 = call i32 (...) @timer_install()
%6 = call i32 (...) @keyboard_install()
%7 = call i32 (...) @mouse_install()
%8 = call i32 (...) @clear_keyboard_buffers()
%9 = call i32 (i32, i32, ...) bitcast (i32 (...)* @clear to i32 (i32, i32, ...)*)(i32 0, i32 0)
%10 = call i32 (...) @dirreen()
br label %11
11: ; preds = %11, %0
br label %11
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @gdt_install()
%2 = tail call i32 (...) @idt_install()
%3 = tail call i32 (...) @isrs_install()
%4 = tail call i32 (...) @irq_install()
%5 = tail call i32 (...) @timer_install()
%6 = tail call i32 (...) @keyboard_install()
%7 = tail call i32 (...) @mouse_install()
tail call void asm sideeffect "sti", "~{dirflag},~{fpsr},~{flags}"()
%8 = tail call i32 (...) @clear_keyboard_buffers()
%9 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @clear to i32 (i32, i32, ...)*)(i32 0, i32 0)
%10 = tail call i32 (...) @dirreen()
br label %11
11: ; preds = %11, %0
br label %11
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
long write(int, unsigned short *, long);
long int PortWriteBin(int fd, unsigned short int databin[]) {
  long int len = 32768, n = 0;
  n = write(fd, databin, len);
  if (n < 0) {
    fputs("write failed!\n", stderr);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<PortWriteBin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x8000,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <write@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jge    1180 <PortWriteBin+0x60>
mov    0x2e7b(%rip),%rax
mov    (%rax),%esi
lea    0xe92(%rip),%rdi
call   1040 <fputs@plt>
movq   $0x0,-0x8(%rbp)
jmp    1188 <PortWriteBin+0x68>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PortWriteBin>:
push   %rax
mov    $0x8000,%edx
call   1030 <write@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
js     113a <PortWriteBin+0x1a>
pop    %rcx
ret
mov    0x2e9f(%rip),%rax
mov    (%rax),%esi
lea    0xeb6(%rip),%rdi
call   1040 <fputs@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"write failed!\0A\00"
@stderr = global i32 0
define i64 @PortWriteBin(i32 %0, i16* %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i16*
%6 = alloca i64
%7 = alloca i64
store i32 %0, i32* %4
store i16* %1, i16** %5
store i64 32768, i64* %6
store i64 0, i64* %7
%8 = load i32, i32* %4
%9 = load i16*, i16** %5
%10 = load i64, i64* %6
%11 = call i64 @write(i32 %8, i16* %9, i64 %10)
store i64 %11, i64* %7
%12 = load i64, i64* %7
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 @fputs(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %15)
store i64 0, i64* %3
br label %18
17: ; preds = %2
store i64 1, i64* %3
br label %18
18: ; preds = %17, %14
%19 = load i64, i64* %3
ret i64 %19
}

LLVM IR (-O2):
@.str = [15 x i8] c"write failed!\0A\00"
@stderr = global i32 0
define i64 @PortWriteBin(i32 %0, i16* nocapture %1) {
%3 = tail call i64 @write(i32 %0, i16* %1, i64 32768)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fputs(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %2, %5
%9 = phi i64 [ 0, %5 ], [ 1, %2 ]
ret i64 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ XButtonPressedEvent;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XButtonPressedEvent(void) {
  XButtonPressedEvent *_p =
      (XButtonPressedEvent *)malloc(sizeof(XButtonPressedEvent));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XButtonPressedEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XButtonPressedEvent+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XButtonPressedEvent>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XButtonPressedEvent+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XButtonPressedEvent() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XButtonPressedEvent() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Variables and functions */
int prompt_msg(char *, char *);
int swap_range(void) {
  return prompt_msg("Command Error", "Backwards range given, OK to swap?");
}


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

x86 assembly (clang, -O2):
<swap_range>:
lea    0xee9(%rip),%rdi
lea    0xef0(%rip),%rsi
jmp    1030 <prompt_msg@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Command Error\00"
@.str.1 = [35 x i8] c"Backwards range given, OK to swap?\00"
define i32 @swap_range() {
%1 = call i32 @prompt_msg(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [14 x i8] c"Command Error\00"
@.str.1 = [35 x i8] c"Backwards range given, OK to swap?\00"
define i32 @swap_range() {
%1 = tail call i32 @prompt_msg(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ bar0();
int /*<<< orphan*/ bar1();
int /*<<< orphan*/ bar2();
int /*<<< orphan*/ bar3();
void foo(int a) {
  if (a < 100)
    return;
  if (200 < a)
    return;
  switch (a) {
  case 99:
    bar0();
    return;
  case 100:
    bar1();
    return;
  case 101:
    bar2();
    return;
  case 102:
    bar3();
    return;
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    115a <foo+0x1a>
jmp    11c1 <foo+0x81>
mov    $0xc8,%eax
cmp    -0x4(%rbp),%eax
jge    116d <foo+0x2d>
jmp    11c1 <foo+0x81>
mov    -0x4(%rbp),%eax
add    $0xffffff9d,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11c1 <foo+0x81>
mov    -0x10(%rbp),%rax
lea    0xe73(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1030 <bar0@plt>
jmp    11c1 <foo+0x81>
mov    $0x0,%al
call   1050 <bar1@plt>
jmp    11c1 <foo+0x81>
mov    $0x0,%al
call   1040 <bar2@plt>
jmp    11c1 <foo+0x81>
mov    $0x0,%al
call   1060 <bar3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
lea    -0xc9(%rdi),%eax
cmp    $0xffffff9b,%eax
jb     1151 <foo+0x21>
cmp    $0x66,%edi
je     1152 <foo+0x22>
cmp    $0x65,%edi
je     1159 <foo+0x29>
cmp    $0x64,%edi
jne    1151 <foo+0x21>
xor    %eax,%eax
jmp    1040 <bar1@plt>
ret
xor    %eax,%eax
jmp    1050 <bar3@plt>
xor    %eax,%eax
jmp    1030 <bar2@plt>

LLVM IR (-O0):
define void @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 100
br i1 %4, label %5, label %6
5: ; preds = %1
br label %20
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp slt i32 200, %7
br i1 %8, label %9, label %10
9: ; preds = %6
br label %20
10: ; preds = %6
%11 = load i32, i32* %2
switch i32 %11, label %20 [
i32 99, label %12
i32 100, label %14
i32 101, label %16
i32 102, label %18
]
12: ; preds = %10
%13 = call i32 (...) @bar0()
br label %20
14: ; preds = %10
%15 = call i32 (...) @bar1()
br label %20
16: ; preds = %10
%17 = call i32 (...) @bar2()
br label %20
18: ; preds = %10
%19 = call i32 (...) @bar3()
br label %20
20: ; preds = %5, %9, %12, %14, %16, %18, %10
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = add i32 %0, -201
%3 = icmp ult i32 %2, -101
br i1 %3, label %11, label %4
4: ; preds = %1
switch i32 %0, label %11 [
i32 102, label %9
i32 100, label %5
i32 101, label %7
]
5: ; preds = %4
%6 = tail call i32 (...) @bar1()
br label %11
7: ; preds = %4
%8 = tail call i32 (...) @bar2()
br label %11
9: ; preds = %4
%10 = tail call i32 (...) @bar3()
br label %11
11: ; preds = %1, %5, %7, %9, %4
ret void
}
int get_x_off() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @get_x_off() {
ret i32 0
}
void zero_int_array(int *arr, int length) {
  int i;
  for (i = 0; i < length; i++)
    arr[i] = 0;
  return;
}


x86 assembly (clang, -O0):
<zero_int_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113b <zero_int_array+0x3b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <zero_int_array+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zero_int_array>:
test   %esi,%esi
jle    1126 <zero_int_array+0x16>
push   %rax
mov    %esi,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @zero_int_array(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast i32* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 2
br label %8
8: ; preds = %4, %2
ret void
}
int test_imm_9Dint64_highword_reg(long long val) {
  return ((val >> 32) & (0x9D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_9Dint64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x20,%rdx
and    $0x9d,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_9Dint64_highword_reg>:
movabs $0x9d00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_9Dint64_highword_reg(i64 %0) {
%2 = and i64 %0, 674309865472
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
unsigned short SIO1readData16(void) { return 0; }


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

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

LLVM IR (-O0):
define zeroext i16 @SIO1readData16() {
ret i16 0
}

LLVM IR (-O2):
define zeroext i16 @SIO1readData16() {
ret i16 0
}
int color_offset_f2(int x, int y) {
  return (((y << 10) - (((x << 10) * 310) / 297) - (3 << 10)) >> 10);
}


x86 assembly (clang, -O0):
<color_offset_f2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0xa,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xa,%eax
imul   $0x136,%eax,%eax
mov    $0x129,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
sub    $0xc00,%eax
sar    $0xa,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<color_offset_f2>:
shl    $0xa,%esi
imul   $0x4d800,%edi,%eax
cltq
imul   $0xffffffff91ab8753,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x27,%rax
add    %ecx,%eax
add    %esi,%eax
add    $0xfffff400,%eax
sar    $0xa,%eax
ret

LLVM IR (-O0):
define i32 @color_offset_f2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = shl i32 %5, 10
%7 = load i32, i32* %3
%8 = shl i32 %7, 10
%9 = mul nsw i32 %8, 310
%10 = sdiv i32 %9, 297
%11 = sub nsw i32 %6, %10
%12 = sub nsw i32 %11, 3072
%13 = ashr i32 %12, 10
ret i32 %13
}

LLVM IR (-O2):
define i32 @color_offset_f2(i32 %0, i32 %1) {
%3 = shl i32 %1, 10
%4 = mul i32 %0, 317440
%5 = sdiv i32 %4, -297
%6 = add i32 %3, -3072
%7 = add i32 %6, %5
%8 = ashr i32 %7, 10
ret i32 %8
}
/* Variables and functions */
int ap_cmd_get_float(int, int, float *);
int ap_get_pan(int session, float *pan) {
  return (ap_cmd_get_float(session, 0xcc23, pan));
}


x86 assembly (clang, -O0):
<ap_get_pan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    $0xcc23,%esi
call   1030 <ap_cmd_get_float@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ap_get_pan>:
mov    %rsi,%rdx
mov    $0xcc23,%esi
jmp    1030 <ap_cmd_get_float@plt>

LLVM IR (-O0):
define i32 @ap_get_pan(i32 %0, float* %1) {
%3 = alloca i32
%4 = alloca float*
store i32 %0, i32* %3
store float* %1, float** %4
%5 = load i32, i32* %3
%6 = load float*, float** %4
%7 = call i32 @ap_cmd_get_float(i32 %5, i32 52259, float* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @ap_get_pan(i32 %0, float* %1) {
%3 = tail call i32 @ap_cmd_get_float(i32 %0, i32 52259, float* %1)
ret i32 %3
}
unsigned char get_nibble(unsigned char **ptr, int *nibble) {
  if (*nibble) {
    *nibble = !*nibble;
    return (*(*ptr)++) & 0xf;
  } else {
    *nibble = !*nibble;
    return (*(*ptr)) >> 4;
  }
}


x86 assembly (clang, -O0):
<get_nibble>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
je     114f <get_nibble+0x4f>
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movzbl (%rax),%eax
and    $0xf,%eax
mov    %al,-0x1(%rbp)
jmp    1176 <get_nibble+0x76>
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movzbl (%rax),%eax
sar    $0x4,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_nibble>:
cmpl   $0x0,(%rsi)
je     111a <get_nibble+0x1a>
movl   $0x0,(%rsi)
mov    (%rdi),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rdi)
mov    (%rax),%al
and    $0xf,%al
ret
movl   $0x1,(%rsi)
mov    (%rdi),%rax
mov    (%rax),%al
shr    $0x4,%al
ret

LLVM IR (-O0):
define zeroext i8 @get_nibble(i8** %0, i32* %1) {
%3 = alloca i8
%4 = alloca i8**
%5 = alloca i32*
store i8** %0, i8*** %4
store i32* %1, i32** %5
%6 = load i32*, i32** %5
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %23
9: ; preds = %2
%10 = load i32*, i32** %5
%11 = load i32, i32* %10
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
%15 = load i32*, i32** %5
store i32 %14, i32* %15
%16 = load i8**, i8*** %4
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %16
%19 = load i8, i8* %17
%20 = zext i8 %19 to i32
%21 = and i32 %20, 15
%22 = trunc i32 %21 to i8
store i8 %22, i8* %3
br label %36
23: ; preds = %2
%24 = load i32*, i32** %5
%25 = load i32, i32* %24
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
%28 = zext i1 %27 to i32
%29 = load i32*, i32** %5
store i32 %28, i32* %29
%30 = load i8**, i8*** %4
%31 = load i8*, i8** %30
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = ashr i32 %33, 4
%35 = trunc i32 %34 to i8
store i8 %35, i8* %3
br label %36
36: ; preds = %23, %9
%37 = load i8, i8* %3
ret i8 %37
}

LLVM IR (-O2):
define zeroext i8 @get_nibble(i8** nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %2
store i32 0, i32* %1
%6 = load i8*, i8** %0
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8* %7, i8** %0
%8 = load i8, i8* %6
%9 = and i8 %8, 15
br label %14
10: ; preds = %2
store i32 1, i32* %1
%11 = load i8*, i8** %0
%12 = load i8, i8* %11
%13 = lshr i8 %12, 4
br label %14
14: ; preds = %10, %5
%15 = phi i8 [ %9, %5 ], [ %13, %10 ]
ret i8 %15
}
unsigned long hash(unsigned char *str) {
  unsigned long hash = 5381;
  int c;
  while (c = *str++) {
    hash = ((hash << 5) + hash) + c;
  }
  return (hash % 256);
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     114a <hash+0x4a>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <hash+0x10>
mov    -0x10(%rbp),%rax
and    $0xff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%al
test   %al,%al
je     112f <hash+0x2f>
add    $0x1,%rdi
mov    $0x1505,%ecx
nop
mov    %rcx,%rdx
shl    $0x5,%rdx
add    %rcx,%rdx
movzbl %al,%ecx
add    %rdx,%rcx
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <hash+0x10>
movzbl %cl,%eax
ret
mov    $0x5,%eax
ret

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

LLVM IR (-O2):
define i64 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = mul i64 %7, 33
%10 = zext i8 %5 to i64
%11 = add i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i64 %11, 255
br label %16
16: ; preds = %14, %1
%17 = phi i64 [ 5, %1 ], [ %15, %14 ]
ret i64 %17
}
/* Variables and functions */
int /*<<< orphan*/ timer_start();
void led_timer_start(void) { timer_start(); }


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

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

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

LLVM IR (-O2):
define void @led_timer_start() {
%1 = tail call i32 (...) @timer_start()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int pthread_detach(pthread_t a) { assert(0); }


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

x86 assembly (clang, -O2):
<pthread_detach>:
xor    %edi,%edi
jmp    1030 <assert@plt>

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

LLVM IR (-O2):
define i32 @pthread_detach(i32 %0) {
%2 = tail call i32 @assert(i32 0)
ret i32 undef
}
int pathconN_nm3_n_out(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @pathconN_nm3_n_out() {
ret i32 2
}

LLVM IR (-O2):
define i32 @pathconN_nm3_n_out() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void header_print(char *msg) {
  printf("\n=============================================\n");
  printf("%s\n", msg);
  printf("\n");
}


x86 assembly (clang, -O0):
<header_print>:
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    0xefb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<header_print>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@str = [47 x i8] c"\0A=============================================\00"
define void @header_print(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) %0)
%4 = tail call i32 @putchar(i32 10)
ret void
}