xunge/DecIR huggingface dataset:
/* Variables and functions */
long double pow(int, long double);
long double exp2(long double x) { return pow(2, x); }


x86 assembly (clang, -O0):
<exp2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
mov    $0x2,%edi
call   1030 <pow@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exp2>:
mov    $0x2,%edi
jmp    1030 <pow@plt>

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

LLVM IR (-O2):
define x86_fp80 @exp2(x86_fp80 %0) {
%2 = tail call x86_fp80 @pow(i32 2, x86_fp80 %0)
ret x86_fp80 %2
}
int test_imm_EFuint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xEF << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_EFuint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 1026497183744
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
void BSP_Microphone_Input(uint16_t *mic) {
  (*((volatile uint32_t *)0x40038028)) = 0x0008;
  while (((*((volatile uint32_t *)0x40038004)) & 0x08) == 0) {
  };
  *mic = (*((volatile uint32_t *)0x400380A8)) >> 2;
  (*((volatile uint32_t *)0x4003800C)) = 0x0008;
}


x86 assembly (clang, -O0):
<BSP_Microphone_Input>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x40038028,%eax
movl   $0x8,(%rax)
mov    $0x40038004,%eax
mov    (%rax),%eax
and    $0x8,%eax
cmp    $0x0,%eax
jne    112b <BSP_Microphone_Input+0x2b>
jmp    1113 <BSP_Microphone_Input+0x13>
mov    $0x400380a8,%eax
mov    (%rax),%ecx
sar    $0x2,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x4003800c,%eax
movl   $0x8,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSP_Microphone_Input>:
movl   $0x8,0x40038028
nopl   0x0(%rax,%rax,1)
testl  $0x8,0x40038004
je     1110 <BSP_Microphone_Input+0x10>
mov    0x400380a8,%eax
sar    $0x2,%eax
mov    %eax,(%rdi)
movl   $0x8,0x4003800c
ret

LLVM IR (-O0):
define void @BSP_Microphone_Input(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
store volatile i32 8, i32* inttoptr (i64 1073971240 to i32*)
br label %3
3: ; preds = %7, %1
%4 = load volatile i32, i32* inttoptr (i64 1073971204 to i32*)
%5 = and i32 %4, 8
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = load volatile i32, i32* inttoptr (i64 1073971368 to i32*)
%10 = ashr i32 %9, 2
%11 = load i32*, i32** %2
store i32 %10, i32* %11
store volatile i32 8, i32* inttoptr (i64 1073971212 to i32*)
ret void
}

LLVM IR (-O2):
define void @BSP_Microphone_Input(i32* nocapture writeonly %0) {
store volatile i32 8, i32* inttoptr (i64 1073971240 to i32*)
br label %2
2: ; preds = %2, %1
%3 = load volatile i32, i32* inttoptr (i64 1073971204 to i32*)
%4 = and i32 %3, 8
%5 = icmp eq i32 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
%7 = load volatile i32, i32* inttoptr (i64 1073971368 to i32*)
%8 = ashr i32 %7, 2
store i32 %8, i32* %0
store volatile i32 8, i32* inttoptr (i64 1073971212 to i32*)
ret void
}
/* Variables and functions */
int sg_init();
int statgrab_init() { return sg_init(); }


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

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

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

LLVM IR (-O2):
define i32 @statgrab_init() {
%1 = tail call i32 (...) @sg_init()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ waitpid(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int main() {
  waitpid(0, 0, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1030 <waitpid@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <waitpid@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @waitpid(i32 0, i32 0, i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("mrr <options>\n"
         "-h             print mrr usage\n"
         "-s             server mode\n"
         "-addr ip       server address\n"
         "-port port     server port\n"
         "-backlog num   listen backlog\n"
         "-sleep usec    sleep <usec> microseconds between requests\n"
         "-m size        message size in bytes\n"
         "-t threads     request-response threads\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [295 x i8] c"mrr <options>\0A-h print mrr usage\0A-s server mode\0A-addr ip server address\0A-port port server port\0A-backlog num listen backlog\0A-sleep usec sleep <usec> microseconds between requests\0A-m size message size in bytes\0A-t threads request-response threads\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([295 x i8], [295 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [294 x i8] c"mrr <options>\0A-h print mrr usage\0A-s server mode\0A-addr ip server address\0A-port port server port\0A-backlog num listen backlog\0A-sleep usec sleep <usec> microseconds between requests\0A-m size message size in bytes\0A-t threads request-response threads\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([294 x i8], [294 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ agent_cleanup();
int /*<<< orphan*/ env_cleanup();
void RL_cleanup() {
  env_cleanup();
  agent_cleanup();
}


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

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

LLVM IR (-O0):
define void @RL_cleanup() {
%1 = call i32 (...) @env_cleanup()
%2 = call i32 (...) @agent_cleanup()
ret void
}

LLVM IR (-O2):
define void @RL_cleanup() {
%1 = tail call i32 (...) @env_cleanup()
%2 = tail call i32 (...) @agent_cleanup()
ret void
}
/* Variables and functions */
char *getBundleFolder();
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
const char *get_resource_path(char *file) {
  static char resource_path[1024];
  sprintf(resource_path, "%s/%s", getBundleFolder(), file);
  return resource_path;
}


x86 assembly (clang, -O0):
<get_resource_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getBundleFolder@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rcx
lea    0x2eff(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1040 <sprintf@plt>
lea    0x2eec(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_resource_path>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <getBundleFolder@plt>
lea    0x2f0b(%rip),%r14
lea    0xec4(%rip),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
mov    %rbx,%rcx
call   1040 <sprintf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@get_resource_path.resource_path = internal global [1024 x i8] zeroinitializer
@.str = [6 x i8] c"%s/%s\00"
define i8* @get_resource_path(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i8* (...) @getBundleFolder()
%4 = load i8*, i8** %2
%5 = call i32 @sprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @get_resource_path.resource_path, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @get_resource_path.resource_path, i64 0, i64 0)
}

LLVM IR (-O2):
@get_resource_path.resource_path = internal global [1024 x i8] zeroinitializer
@.str = [6 x i8] c"%s/%s\00"
define i8* @get_resource_path(i8* %0) {
%2 = tail call i8* (...) @getBundleFolder()
%3 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @get_resource_path.resource_path, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %0)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @get_resource_path.resource_path, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int read(int /*<<< orphan*/, char *, int);
int main(void) {
  char buf[1024];
  int ret = read(0, buf, 20);
  buf[ret] = 0;
  printf("%s\n", buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rsi
xor    %edi,%edi
mov    $0x14,%edx
call   1040 <read@plt>
mov    %eax,-0x414(%rbp)
movslq -0x414(%rbp),%rax
movb   $0x0,-0x410(%rbp,%rax,1)
lea    -0x410(%rbp),%rsi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x14,%edx
call   1040 <read@plt>
cltq
movb   $0x0,(%rsp,%rax,1)
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i32 @read(i32 0, i8* %4, i32 20)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %7
store i8 0, i8* %8
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @read(i32 0, i8* %2, i32 20)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %4
store i8 0, i8* %5
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ demo();
int main(void) {
  demo();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <demo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <demo@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @demo()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @demo()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void close_watchdog(int fd) { close(fd); }


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

x86 assembly (clang, -O2):
<close_watchdog>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @close_watchdog(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
void INT_Excep_MTU1_TGIA1(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_MTU1_TGIA1() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ _panicHandler(char const *, int /*<<< orphan*/);
void android_vpanic(const char *fmt, va_list args) { _panicHandler(fmt, args); }


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

x86 assembly (clang, -O2):
<android_vpanic>:
jmp    1030 <_panicHandler@plt>

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

LLVM IR (-O2):
define void @android_vpanic(i8* %0, i32 %1) {
%3 = tail call i32 @_panicHandler(i8* %0, i32 %1)
ret void
}
int rpcc() {
  static int ctr = 0;
  ctr++;
  return ctr;
}


x86 assembly (clang, -O0):
<rpcc>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f11(%rip)
mov    0x2f0b(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpcc>:
mov    0x2f1e(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f15(%rip)
ret

LLVM IR (-O0):
@rpcc.ctr = internal global i32 0
define i32 @rpcc() {
%1 = load i32, i32* @rpcc.ctr
%2 = add nsw i32 %1, 1
store i32 %2, i32* @rpcc.ctr
%3 = load i32, i32* @rpcc.ctr
ret i32 %3
}

LLVM IR (-O2):
@rpcc.ctr = internal unnamed_addr global i32 0
define i32 @rpcc() {
%1 = load i32, i32* @rpcc.ctr
%2 = add nsw i32 %1, 1
store i32 %2, i32* @rpcc.ctr
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ acc_copyin(int *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int i;
  acc_copyin(&i, sizeof i);
  fprintf(stderr, "CheCKpOInT\n");
#pragma acc data copy(i)
  ++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>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
lea    0xeac(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
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>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"CheCKpOInT\0A\00"
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)
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %6
%11 = add nsw i32 %10, 1
store i32 %11, i32* %6
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"CheCKpOInT\0A\00"
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)
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
unsigned short P4RGBA(unsigned short BGR) {
  if (!BGR)
    return 0;
  return (((((BGR & 0x1e) << 11)) | ((BGR & 0x7800) >> 7) |
           ((BGR & 0x3c0) << 2))) |
         0xf;
}


x86 assembly (clang, -O0):
<P4RGBA>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x4(%rbp)
cmpw   $0x0,-0x4(%rbp)
jne    1121 <P4RGBA+0x21>
movw   $0x0,-0x2(%rbp)
jmp    1150 <P4RGBA+0x50>
movzwl -0x4(%rbp),%eax
and    $0x1e,%eax
shl    $0xb,%eax
movzwl -0x4(%rbp),%ecx
and    $0x7800,%ecx
sar    $0x7,%ecx
or     %ecx,%eax
movzwl -0x4(%rbp),%ecx
and    $0x3c0,%ecx
shl    $0x2,%ecx
or     %ecx,%eax
or     $0xf,%eax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<P4RGBA>:
test   %edi,%edi
je     1123 <P4RGBA+0x23>
movzwl %di,%eax
mov    %eax,%ecx
shl    $0xb,%ecx
shr    $0x7,%eax
or     %ecx,%eax
and    $0x3c0,%edi
and    $0xf0f0,%eax
lea    (%rax,%rdi,4),%eax
add    $0xf,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define zeroext i16 @P4RGBA(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %3
%4 = load i16, i16* %3
%5 = icmp ne i16 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1
store i16 0, i16* %2
br label %24
7: ; preds = %1
%8 = load i16, i16* %3
%9 = zext i16 %8 to i32
%10 = and i32 %9, 30
%11 = shl i32 %10, 11
%12 = load i16, i16* %3
%13 = zext i16 %12 to i32
%14 = and i32 %13, 30720
%15 = ashr i32 %14, 7
%16 = or i32 %11, %15
%17 = load i16, i16* %3
%18 = zext i16 %17 to i32
%19 = and i32 %18, 960
%20 = shl i32 %19, 2
%21 = or i32 %16, %20
%22 = or i32 %21, 15
%23 = trunc i32 %22 to i16
store i16 %23, i16* %2
br label %24
24: ; preds = %7, %6
%25 = load i16, i16* %2
ret i16 %25
}

LLVM IR (-O2):
define zeroext i16 @P4RGBA(i16 zeroext %0) {
%2 = icmp eq i16 %0, 0
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = shl i16 %0, 11
%5 = and i16 %4, -4096
%6 = lshr i16 %0, 7
%7 = and i16 %6, 240
%8 = shl i16 %0, 2
%9 = and i16 %8, 3840
%10 = or i16 %7, %5
%11 = or i16 %10, %9
%12 = or i16 %11, 15
br label %13
13: ; preds = %1, %3
%14 = phi i16 [ %12, %3 ], [ 0, %1 ]
ret i16 %14
}
void clean_array(int array[]) {
  short int i = 0;
  short int len = 0;
  len = sizeof(array);
  for (i = 0; i < len; ++i) {
    array[i] = 0;
  };
}


x86 assembly (clang, -O0):
<clean_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movw   $0x0,-0xa(%rbp)
movw   $0x0,-0xc(%rbp)
movw   $0x8,-0xc(%rbp)
movw   $0x0,-0xa(%rbp)
movswl -0xa(%rbp),%eax
movswl -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    1151 <clean_array+0x51>
mov    -0x8(%rbp),%rax
movswq -0xa(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0xa(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xa(%rbp)
jmp    1120 <clean_array+0x20>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_array>:
xorps  %xmm0,%xmm0
movups %xmm0,0x10(%rdi)
movups %xmm0,(%rdi)
ret

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

LLVM IR (-O2):
define void @clean_array(i32* nocapture writeonly %0) {
%2 = bitcast i32* %0 to i8*
ret void
}
/* Variables and functions */
scalar_t__ _PDCLIB_atomax(char const *);
long long int atoll(const char *s) { return (long long int)_PDCLIB_atomax(s); }


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

x86 assembly (clang, -O2):
<atoll>:
jmp    1030 <_PDCLIB_atomax@plt>

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

LLVM IR (-O2):
define i64 @atoll(i8* %0) {
%2 = tail call i64 @_PDCLIB_atomax(i8* %0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void func_l() {
  int i, j;
  for (;;) {
    usleep(1000 * 1000);
    for (i = 0, j = 0; i < (10 * 1000 * 1000); i++) {
      j++;
    }
  }
}


x86 assembly (clang, -O0):
<func_l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xf4240,%edi
call   1030 <usleep@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x989680,-0x4(%rbp)
jge    1154 <func_l+0x44>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1130 <func_l+0x20>
jmp    1118 <func_l+0x8>

x86 assembly (clang, -O2):
<func_l>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xf4240,%edi
call   1030 <usleep@plt>
jmp    1120 <func_l+0x10>

LLVM IR (-O0):
define void @func_l() {
%1 = alloca i32
%2 = alloca i32
br label %3
3: ; preds = %14, %0
%4 = call i32 @usleep(i32 1000000)
store i32 0, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %11, %3
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 10000000
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
br label %11
11: ; preds = %8
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 1
store i32 %13, i32* %1
br label %5
14: ; preds = %5
br label %3
}

LLVM IR (-O2):
define void @func_l() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @usleep(i32 1000000)
br label %1
}
void test0(char *P) {
  char *a = (char *)P;
  short *b = (short *)P;
  int *c = (int *)P;
}


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

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

LLVM IR (-O0):
define void @test0(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i16*
%5 = alloca i32*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %3
%7 = load i8*, i8** %2
%8 = bitcast i8* %7 to i16*
store i16* %8, i16** %4
%9 = load i8*, i8** %2
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %5
ret void
}

LLVM IR (-O2):
define void @test0(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int strcasecmp(char *, char *);
void strcasecmp_diff_length_2() {
  char *x = "aBcDe";
  char *y = "abc";
  if (strcasecmp(x, y) != 1)
    (void)*(char *)0;
}


x86 assembly (clang, -O0):
<strcasecmp_diff_length_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xedc(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x1,%eax
je     1144 <strcasecmp_diff_length_2+0x34>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @strcasecmp_diff_length_2() {
ret void
}
void showMenu() {}


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

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

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

LLVM IR (-O2):
define void @showMenu() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void Destroy(void *Item) {
  if (Item)
    free(Item);
}


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

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

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

LLVM IR (-O2):
define void @Destroy(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
long __ccaprice_syscall_args_1(long A0, long A1) {
  unsigned long R;
  __asm__ __volatile__("syscall"
                       : "=a"(R)
                       : "a"(A0), "D"(A1)
                       : "rcx", "r11", "memory");
  return R;
}


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

x86 assembly (clang, -O2):
<__ccaprice_syscall_args_1>:
mov    %rdi,%rax
mov    %rsi,%rdi
syscall
ret

LLVM IR (-O0):
define i64 @__ccaprice_syscall_args_1(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i64 asm sideeffect "syscall", "={ax},{ax},{di},~{rcx},~{r11},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %6, i64 %7)
store i64 %8, i64* %5
%9 = load i64, i64* %5
ret i64 %9
}

LLVM IR (-O2):
define i64 @__ccaprice_syscall_args_1(i64 %0, i64 %1) {
%3 = tail call i64 asm sideeffect "syscall", "={ax},{ax},{di},~{rcx},~{r11},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 %1)
ret i64 %3
}
/* Variables and functions */
long aioPoll(long);
long aioSleepForUsecs(long microSeconds) { return aioPoll(microSeconds); }


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

x86 assembly (clang, -O2):
<aioSleepForUsecs>:
jmp    1030 <aioPoll@plt>

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

LLVM IR (-O2):
define i64 @aioSleepForUsecs(i64 %0) {
%2 = tail call i64 @aioPoll(i64 %0)
ret i64 %2
}
/* Type definitions */
struct kcfg {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct kcfg *);
void kcfg_destroy(struct kcfg *kcfg) {
  if (kcfg)
    free(kcfg);
}


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

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

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

LLVM IR (-O2):
%struct.kcfg = type { i32 }
define void @kcfg_destroy(%struct.kcfg* %0) {
%2 = icmp eq %struct.kcfg* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.kcfg* %0)
br label %5
5: ; preds = %3, %1
ret void
}
unsigned int p11c_hash_integer(int integer) { return integer; }


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

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

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

LLVM IR (-O2):
define i32 @p11c_hash_integer(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ bug1();
int /*<<< orphan*/ bug4();
int /*<<< orphan*/ bug5();
int main(void) {
  unsigned int ret;
  bug1();
  bug4();
  bug5();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <bug1@plt>
mov    $0x0,%al
call   1050 <bug4@plt>
mov    $0x0,%al
call   1040 <bug5@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <bug1@plt>
xor    %eax,%eax
call   1050 <bug4@plt>
xor    %eax,%eax
call   1040 <bug5@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @bug1()
%4 = call i32 (...) @bug4()
%5 = call i32 (...) @bug5()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @bug1()
%2 = tail call i32 (...) @bug4()
%3 = tail call i32 (...) @bug5()
ret i32 0
}
int guild_skill_get_range(int id) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @guild_skill_get_range(i32 %0) {
ret i32 0
}
/* Variables and functions */
int MCL_CURRENT;
int MCL_FUTURE;
int /*<<< orphan*/ fatal(char *);
scalar_t__ mlockall(int);
int rt_memory_lock(int pid) {
  if (mlockall(MCL_CURRENT | MCL_FUTURE) != 0) {
    fatal("ERROR : rt_memory_lock : mlockall error : ");
  }
  return 0;
}


x86 assembly (clang, -O0):
<rt_memory_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    0x2eb5(%rip),%rax
or     (%rax),%edi
call   1030 <mlockall@plt>
cmp    $0x0,%rax
je     1158 <rt_memory_lock+0x38>
lea    0xead(%rip),%rdi
call   1040 <fatal@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rt_memory_lock>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    0x2ec1(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   1030 <mlockall@plt>
test   %rax,%rax
je     1149 <rt_memory_lock+0x29>
lea    0xebc(%rip),%rdi
call   1040 <fatal@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@MCL_CURRENT = global i32 0
@MCL_FUTURE = global i32 0
@.str = [43 x i8] c"ERROR : rt_memory_lock : mlockall error : \00"
define i32 @rt_memory_lock(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @MCL_CURRENT
%4 = load i32, i32* @MCL_FUTURE
%5 = or i32 %3, %4
%6 = call i64 @mlockall(i32 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @fatal(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
ret i32 0
}

LLVM IR (-O2):
@MCL_CURRENT = global i32 0
@MCL_FUTURE = global i32 0
@.str = [43 x i8] c"ERROR : rt_memory_lock : mlockall error : \00"
define i32 @rt_memory_lock(i32 %0) {
%2 = load i32, i32* @MCL_CURRENT
%3 = load i32, i32* @MCL_FUTURE
%4 = or i32 %3, %2
%5 = tail call i64 @mlockall(i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @fatal(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
ret i32 0
}
/* Type definitions */
struct stack {
  int dummy;
};

/* Variables and functions */
struct stack *stack_init() {
  return NULL;
}


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

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

LLVM IR (-O0):
%struct.stack = type { i32 }
define %struct.stack* @stack_init() {
ret %struct.stack* null
}

LLVM IR (-O2):
%struct.stack = type { i32 }
define noalias %struct.stack* @stack_init() {
ret %struct.stack* null
}
void termop_resetmode(struct ansiseq *s) {
  tnc_log_log(
      7, 4, -1,
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/xterm.c",
      467, __func__, "unhandled");
  ansiseq_dump(s);
}


x86 assembly (clang, -O0):
<termop_resetmode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x7,%edi
mov    $0x4,%esi
mov    $0xffffffff,%edx
lea    0xebe(%rip),%rcx
mov    $0x1d3,%r8d
lea    0xf37(%rip),%r9
lea    0xf41(%rip),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <tnc_log_log@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <ansiseq_dump@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<termop_resetmode>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xf68(%rip),%rax
mov    %rax,(%rsp)
lea    0xec6(%rip),%rcx
lea    0xf45(%rip),%r9
mov    $0x7,%edi
mov    $0x4,%esi
mov    $0xffffffff,%edx
mov    $0x1d3,%r8d
xor    %eax,%eax
call   1030 <tnc_log_log@plt>
mov    %rbx,%rdi
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1040 <ansiseq_dump@plt>

LLVM IR (-O0):
%struct.ansiseq = type opaque
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/xterm.c\00"
@__func__.termop_resetmode = [17 x i8] c"termop_resetmode\00"
@.str.1 = [10 x i8] c"unhandled\00"
define void @termop_resetmode(%struct.ansiseq* %0) {
%2 = alloca %struct.ansiseq*
store %struct.ansiseq* %0, %struct.ansiseq** %2
%3 = call i32 (i32, i32, i32, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @tnc_log_log to i32 (i32, i32, i32, i8*, i32, i8*, i8*, ...)*)(i32 7, i32 4, i32 -1, i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i32 467, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__func__.termop_resetmode, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%4 = load %struct.ansiseq*, %struct.ansiseq** %2
%5 = call i32 (%struct.ansiseq*, ...) bitcast (i32 (...)* @ansiseq_dump to i32 (%struct.ansiseq*, ...)*)(%struct.ansiseq* %4)
ret void
}

LLVM IR (-O2):
%struct.ansiseq = type opaque
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/xterm.c\00"
@__func__.termop_resetmode = [17 x i8] c"termop_resetmode\00"
@.str.1 = [10 x i8] c"unhandled\00"
define void @termop_resetmode(%struct.ansiseq* %0) {
%2 = tail call i32 (i32, i32, i32, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @tnc_log_log to i32 (i32, i32, i32, i8*, i32, i8*, i8*, ...)*)(i32 7, i32 4, i32 -1, i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i32 467, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__func__.termop_resetmode, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (%struct.ansiseq*, ...) bitcast (i32 (...)* @ansiseq_dump to i32 (%struct.ansiseq*, ...)*)(%struct.ansiseq* %0)
ret void
}
unsigned xrop3_50_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = T | S;
  stk2 = D | stk3;
  stk1 = S ^ stk2;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_50_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_50_1_0>:
mov    %edi,%ecx
shl    $0x8,%ecx
lea    (%rcx,%rdi,1),%eax
shl    $0x8,%esi
or     %esi,%ecx
or     $0xff,%ecx
not    %eax
and    %ecx,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_50_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = or i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %5
%27 = load i32, i32* %10
%28 = or i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %6
%30 = load i32, i32* %9
%31 = xor i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = load i32, i32* %6
%34 = xor i32 %33, -1
%35 = and i32 %32, %34
%36 = load i32, i32* %5
%37 = load i32, i32* %6
%38 = and i32 %36, %37
%39 = or i32 %35, %38
ret i32 %39
}

LLVM IR (-O2):
define i32 @xrop3_50_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = or i32 %4, %3
%6 = zext i8 %1 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %4, %7
%9 = or i32 %8, 255
%10 = xor i32 %5, -1
%11 = and i32 %9, %10
%12 = or i32 %11, %3
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ syslog(int, char *, char const *);
void log_to_syslog(int pri, const char *logbuf) { syslog(pri, "%s", logbuf); }


x86 assembly (clang, -O0):
<log_to_syslog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xed3(%rip),%rsi
call   1030 <syslog@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_to_syslog>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <syslog@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @log_to_syslog(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 = call i32 @syslog(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @log_to_syslog(i32 %0, i8* %1) {
%3 = tail call i32 @syslog(i32 %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
int *malloc(int);
int *malloc_int(int i) {
  int *int_ptr;
  int_ptr = malloc(sizeof(int));
  *(int *)int_ptr = i;
  return int_ptr;
}


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

x86 assembly (clang, -O2):
<malloc_int>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %ebx,(%rax)
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i32* @malloc_int(i32 %0) {
%2 = tail call i32* @malloc(i32 4)
store i32 %0, i32* %2
ret i32* %2
}
/* Variables and functions */
scalar_t__ isLower(unsigned int);
int isUpper(unsigned int);
int isLetter(unsigned int c) {
  return (c != '\0' && (isLower(c) ? !0 : isUpper(c)));
}


x86 assembly (clang, -O0):
<isLetter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1170 <isLetter+0x50>
mov    -0x4(%rbp),%edi
call   1030 <isLower@plt>
cmp    $0x0,%rax
je     1159 <isLetter+0x39>
mov    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1164 <isLetter+0x44>
mov    -0x4(%rbp),%edi
call   1040 <isUpper@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLetter>:
push   %rbx
test   %edi,%edi
je     113b <isLetter+0x1b>
mov    %edi,%ebx
call   1030 <isLower@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     113f <isLetter+0x1f>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
mov    %ebx,%edi
call   1040 <isUpper@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isLetter(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %16
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i64 @isLower(i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
br label %13
10: ; preds = %5
%11 = load i32, i32* %2
%12 = call i32 @isUpper(i32 %11)
br label %13
13: ; preds = %10, %9
%14 = phi i32 [ 1, %9 ], [ %12, %10 ]
%15 = icmp ne i32 %14, 0
br label %16
16: ; preds = %13, %1
%17 = phi i1 [ false, %1 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @isLetter(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i64 @isLower(i32 %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i32 @isUpper(i32 %0)
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %3, %1
%11 = phi i32 [ 0, %1 ], [ %9, %6 ], [ 1, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ srand(unsigned int);
int init_int(void) {
  unsigned seed = 123456;
  srand(seed);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @init_int() {
%1 = alloca i32
store i32 123456, i32* %1
%2 = load i32, i32* %1
%3 = call i32 @srand(i32 %2)
ret i32 0
}

LLVM IR (-O2):
define i32 @init_int() {
%1 = tail call i32 @srand(i32 123456)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void sayHello() { printf("Hello\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"Hello\00"
define void @sayHello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ NiashReadReg(int, int, unsigned char *);
void WaitReadyBit(int iHandle) {
  unsigned char bData;
  do {
    NiashReadReg(iHandle, 0x03, &bData);
  } while ((bData & 8) == 0);
}


x86 assembly (clang, -O0):
<WaitReadyBit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x3,%esi
lea    -0x5(%rbp),%rdx
call   1030 <NiashReadReg@plt>
movzbl -0x5(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     111b <WaitReadyBit+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WaitReadyBit>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x7(%rsp),%r14
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    $0x3,%esi
mov    %r14,%rdx
call   1030 <NiashReadReg@plt>
testb  $0x8,0x7(%rsp)
je     1120 <WaitReadyBit+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @WaitReadyBit(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = call i32 @NiashReadReg(i32 %5, i32 3, i8* %3)
br label %7
7: ; preds = %4
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = and i32 %9, 8
%11 = icmp eq i32 %10, 0
br i1 %11, label %4, label %12
12: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @WaitReadyBit(i32 %0) {
%2 = alloca i8
br label %3
3: ; preds = %3, %1
%4 = call i32 @NiashReadReg(i32 %0, i32 3, i8* %2)
%5 = load i8, i8* %2
%6 = and i8 %5, 8
%7 = icmp eq i8 %6, 0
br i1 %7, label %3, label %8
8: ; preds = %3
ret void
}
char *skip_blanks(char *p) {
  while (*p == ' ' || *p == '\t')
    p++;
  return p;
}


x86 assembly (clang, -O0):
<skip_blanks>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x9(%rbp)
je     112d <skip_blanks+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113d <skip_blanks+0x3d>
jmp    114e <skip_blanks+0x4e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <skip_blanks+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_blanks>:
mov    %rdi,%rax
jmp    1114 <skip_blanks+0x14>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     1110 <skip_blanks+0x10>
cmp    $0x9,%cl
je     1110 <skip_blanks+0x10>
ret

LLVM IR (-O0):
define i8* @skip_blanks(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %15, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 32
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 9
br label %13
13: ; preds = %8, %3
%14 = phi i1 [ true, %3 ], [ %12, %8 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %3
18: ; preds = %13
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define i8* @skip_blanks(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 32, label %5
i8 9, label %5
]
5: ; preds = %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
ret i8* %3
}