xunge/DecIR huggingface dataset:
/* Type definitions */
struct flashrom_flashctx {
  int dummy;
};

/* Variables and functions */
int spi_write_cmd(struct flashrom_flashctx *, int, int, unsigned int,
                  int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int spi_block_erase_d8(struct flashrom_flashctx *flash, unsigned int addr,
                       unsigned int blocklen) {
  return spi_write_cmd(flash, 0xd8, false, addr, NULL, 0, 100 * 1000);
}


x86 assembly (clang, -O0):
<spi_block_erase_d8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    $0xd8,%esi
xor    %r9d,%r9d
xor    %eax,%eax
mov    %eax,%r8d
mov    %r9d,%edx
movl   $0x186a0,(%rsp)
call   1030 <spi_write_cmd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_block_erase_d8>:
push   %rax
mov    %esi,%ecx
movl   $0x186a0,(%rsp)
mov    $0xd8,%esi
xor    %edx,%edx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <spi_write_cmd@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_block_erase_d8(%struct.flashrom_flashctx* %0, i32 %1, i32 %2) {
%4 = alloca %struct.flashrom_flashctx*
%5 = alloca i32
%6 = alloca i32
store %struct.flashrom_flashctx* %0, %struct.flashrom_flashctx** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.flashrom_flashctx*, %struct.flashrom_flashctx** %4
%8 = load i32, i32* %5
%9 = call i32 @spi_write_cmd(%struct.flashrom_flashctx* %7, i32 216, i32 0, i32 %8, i32* null, i32 0, i32 100000)
ret i32 %9
}

LLVM IR (-O2):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_block_erase_d8(%struct.flashrom_flashctx* %0, i32 %1, i32 %2) {
%4 = tail call i32 @spi_write_cmd(%struct.flashrom_flashctx* %0, i32 216, i32 0, i32 %1, i32* null, i32 0, i32 100000)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ nsc_assert(int);
void copyin(void) {
  nsc_assert(0 && "This function is unimplemented.");
  ;
}


x86 assembly (clang, -O0):
<copyin>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <nsc_assert@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @copyin() {
%1 = call i32 @nsc_assert(i32 0)
ret void
}

LLVM IR (-O2):
define void @copyin() {
%1 = tail call i32 @nsc_assert(i32 0)
ret void
}
void fa69(void) {
P0A:
  goto P0A;
  ({
    P01A:
      goto P01A;
      ({
        P012A:
          goto P012A;
          0;
      });
    P01B:
      goto P01B;
      ({
        a:
          goto a;
        P013A:
          goto P013A;
          0;
      });
    P01C:
      goto P01C;
      0;
  });
P0B:
  goto P0B;
  ({
    P02A:
      goto P02A;
      ({
        P024A:
          goto P024A;
          0;
      });
    P02B:
      goto P02B;
      ({
        P025A:
          goto P025A;
          0;
      });
    P02C:
      goto P02C;
      0;
  });
P0C:
  goto P0C;
  0;
P0D:
  goto P0D;
}


x86 assembly (clang, -O0):
<fa69>:
push   %rbp
mov    %rsp,%rbp
jmp    1104 <fa69+0x4>

x86 assembly (clang, -O2):
<fa69>:
jmp    1100 <fa69>

LLVM IR (-O0):
define void @fa69() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
br label %7
7: ; preds = %7, %0
br label %7
8: ; No predecessors!
br label %9
9: ; preds = %9, %8
br label %9
10: ; No predecessors!
br label %11
11: ; preds = %11, %10
br label %11
12: ; preds = %12
br label %12
13: ; No predecessors!
br label %14
14: ; preds = %14, %13
br label %14
15: ; preds = %15
br label %15
16: ; preds = %16
br label %16
17: ; preds = %17
br label %17
18: ; No predecessors!
br label %19
19: ; preds = %19, %18
br label %19
20: ; No predecessors!
br label %21
21: ; preds = %21, %20
br label %21
22: ; preds = %22
br label %22
23: ; No predecessors!
br label %24
24: ; preds = %24, %23
br label %24
25: ; preds = %25
br label %25
26: ; preds = %26
br label %26
27: ; preds = %27
br label %27
}

LLVM IR (-O2):
define void @fa69() {
br label %1
1: ; preds = %1, %0
br label %1
}
const char *sqlite3_errstr(int rc) {
  return rc ? "unknown error" : "not an error";
}


x86 assembly (clang, -O0):
<sqlite3_errstr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xefd(%rip),%rax
lea    0xee8(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqlite3_errstr>:
test   %edi,%edi
lea    0xf05(%rip),%rcx
lea    0xef0(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [14 x i8] c"unknown error\00"
@.str.1 = [13 x i8] c"not an error\00"
define i8* @sqlite3_errstr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0)
ret i8* %6
}

LLVM IR (-O2):
@.str = [14 x i8] c"unknown error\00"
@.str.1 = [13 x i8] c"not an error\00"
define i8* @sqlite3_errstr(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Variables and functions */
float exp(float);
float gauss0freq(float f, float freq) {
  float value;
  value = f * f / (freq * freq);
  value = exp(-value);
  return value;
}


x86 assembly (clang, -O0):
<gauss0freq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1030 <exp@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gauss0freq>:
mulss  %xmm1,%xmm1
movaps 0xee5(%rip),%xmm2
xorps  %xmm0,%xmm2
mulss  %xmm2,%xmm0
divss  %xmm1,%xmm0
jmp    1030 <exp@plt>

LLVM IR (-O0):
define float @gauss0freq(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = load float, float* %3
%8 = fmul float %6, %7
%9 = load float, float* %4
%10 = load float, float* %4
%11 = fmul float %9, %10
%12 = fdiv float %8, %11
store float %12, float* %5
%13 = load float, float* %5
%14 = fneg float %13
%15 = call float @exp(float %14)
store float %15, float* %5
%16 = load float, float* %5
ret float %16
}

LLVM IR (-O2):
define float @gauss0freq(float %0, float %1) {
%3 = fmul float %1, %1
%4 = fneg float %0
%5 = fmul float %4, %0
%6 = fdiv float %5, %3
%7 = tail call float @exp(float %6)
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ c4(int);
void c3(int i) { c4(i * 7); }


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

x86 assembly (clang, -O2):
<c3>:
lea    0x0(,%rdi,8),%eax
sub    %edi,%eax
mov    %eax,%edi
jmp    1030 <c4@plt>

LLVM IR (-O0):
define void @c3(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 7
%5 = call i32 @c4(i32 %4)
ret void
}

LLVM IR (-O2):
define void @c3(i32 %0) {
%2 = mul nsw i32 %0, 7
%3 = tail call i32 @c4(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  "hello\n";
  "hello\n"[0] = 'x';
  printf("hello\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x78,0xeda(%rip)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct flashctx {
  int dummy;
};

/* Variables and functions */
int spi_disable_blockprotect_at25df(struct flashctx *);
int spi_disable_blockprotect_at25f512b(struct flashctx *flash) {
  return spi_disable_blockprotect_at25df(flash);
}


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

x86 assembly (clang, -O2):
<spi_disable_blockprotect_at25f512b>:
jmp    1030 <spi_disable_blockprotect_at25df@plt>

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

LLVM IR (-O2):
%struct.flashctx = type { i32 }
define i32 @spi_disable_blockprotect_at25f512b(%struct.flashctx* %0) {
%2 = tail call i32 @spi_disable_blockprotect_at25df(%struct.flashctx* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ workerror(char *);
int badly_terminated() {
  workerror("badly terminated keyword value");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"badly terminated keyword value\00"
define i32 @badly_terminated() {
%1 = call i32 @workerror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"badly terminated keyword value\00"
define i32 @badly_terminated() {
%1 = tail call i32 @workerror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
void sigchld_hdl(int sig) {
  pid_t pid;
  while ((pid = waitpid(-1, NULL, WNOHANG)) > 0) {
  }
}


x86 assembly (clang, -O0):
<sigchld_hdl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <waitpid@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1143 <sigchld_hdl+0x33>
jmp    111b <sigchld_hdl+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigchld_hdl>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1030 <waitpid@plt>
test   %eax,%eax
jg     1120 <sigchld_hdl+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
define void @sigchld_hdl(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* @WNOHANG
%6 = call i32 @waitpid(i32 -1, i32* null, i32 %5)
store i32 %6, i32* %3
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %4
br label %4
9: ; preds = %4
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define void @sigchld_hdl(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = load i32, i32* @WNOHANG
%4 = tail call i32 @waitpid(i32 -1, i32* null, i32 %3)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ini_load();
int /*<<< orphan*/ ini_save();
void INI_ReloadSettings(void) {
  ini_load();
  ini_save();
}


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

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

LLVM IR (-O0):
define void @INI_ReloadSettings() {
%1 = call i32 (...) @ini_load()
%2 = call i32 (...) @ini_save()
ret void
}

LLVM IR (-O2):
define void @INI_ReloadSettings() {
%1 = tail call i32 (...) @ini_load()
%2 = tail call i32 (...) @ini_save()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
unsigned char uart_getc(uint32_t base_address) { return 0; }


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

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

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

LLVM IR (-O2):
define zeroext i8 @uart_getc(i32 %0) {
ret i8 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void usage() {
  fputs("Usage: chown [OPTION] OWNER[:[GROUP]] FILE\n\n"
        "OPTIONS:\n"
        "  -v, --verbose      print a message for every created directory\n"
        "    --help           print this message and exit\n"
        "    --version        print version and exit\n",
        stdout);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [212 x i8] c"Usage: chown [OPTION] OWNER[:[GROUP]] FILE\0A\0AOPTIONS:\0A -v, --verbose print a message for every created directory\0A --help print this message and exit\0A --version print version and exit\0A\00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define void @usage() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([212 x i8], [212 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EXIT_SUCCESS
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@.str = [212 x i8] c"Usage: chown [OPTION] OWNER[:[GROUP]] FILE\0A\0AOPTIONS:\0A -v, --verbose print a message for every created directory\0A --help print this message and exit\0A --version print version and exit\0A\00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define void @usage() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([212 x i8], [212 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
size_t mmdb_strnlen(char const *, size_t);
char *mmdb_strndup(const char *str, size_t n) {
  size_t len;
  char *copy;
  len = mmdb_strnlen(str, n);
  if ((copy = malloc(len + 1)) == NULL)
    return (NULL);
  memcpy(copy, str, len);
  copy[len] = '\0';
  return (copy);
}


x86 assembly (clang, -O0):
<mmdb_strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <mmdb_strnlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1179 <mmdb_strndup+0x49>
movq   $0x0,-0x8(%rbp)
jmp    119e <mmdb_strndup+0x6e>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmdb_strndup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1050 <mmdb_strnlen@plt>
mov    %rax,%r15
lea    0x1(%rax),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1164 <mmdb_strndup+0x34>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <memcpy@plt>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @mmdb_strndup(i8* %0, i64 %1) {
%3 = tail call i64 @mmdb_strnlen(i8* %0, i64 %1)
%4 = add i64 %3, 1
%5 = tail call i8* @malloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %3)
%9 = getelementptr inbounds i8, i8* %5, i64 %3
store i8 0, i8* %9
br label %10
10: ; preds = %2, %7
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ UI_LibraryMenu_Cache();
void UI_Library_SpecialCache(void) { UI_LibraryMenu_Cache(); }


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

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

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

LLVM IR (-O2):
define void @UI_Library_SpecialCache() {
%1 = tail call i32 (...) @UI_LibraryMenu_Cache()
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ type;
};
typedef TYPE_1__ XConfigureEvent;

/* Variables and functions */
int get_XConfigureEvent_type(void *_p) {
  return (int)((XConfigureEvent *)_p)->type;
}


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

x86 assembly (clang, -O2):
<get_XConfigureEvent_type>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @get_XConfigureEvent_type(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main(int argc, char const *argv[]) {
  int compteur = 0, somme = 0;
  do {
    compteur++;
    somme = somme + compteur;
  } while (somme < 10);
  printf("compteur=%d, somme=%d \n", compteur, somme);
  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)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jl     1134 <main+0x24>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [24 x i8] c"compteur=%d, somme=%d \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 4, i32 10)
ret i32 0
}
abs(v) int v;
{ return (v > 0 ? v : -v); }


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    111c <abs+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <abs+0x24>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Type definitions */
struct winsize {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ TIOCSWINSZ;
int syscall(int, int, int /*<<< orphan*/, struct winsize const *);
int tcsetwinsize(int fd, const struct winsize *wsz) {
  return syscall(54, fd, TIOCSWINSZ, wsz);
}


x86 assembly (clang, -O0):
<tcsetwinsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rcx
mov    $0x36,%edi
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcsetwinsize>:
mov    %rsi,%rcx
mov    %edi,%esi
mov    0x2ecc(%rip),%rax
mov    (%rax),%edx
mov    $0x36,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.winsize = type { i32 }
@TIOCSWINSZ = global i32 0
define i32 @tcsetwinsize(i32 %0, %struct.winsize* %1) {
%3 = alloca i32
%4 = alloca %struct.winsize*
store i32 %0, i32* %3
store %struct.winsize* %1, %struct.winsize** %4
%5 = load i32, i32* %3
%6 = load i32, i32* @TIOCSWINSZ
%7 = load %struct.winsize*, %struct.winsize** %4
%8 = call i32 @syscall(i32 54, i32 %5, i32 %6, %struct.winsize* %7)
ret i32 %8
}

LLVM IR (-O2):
%struct.winsize = type { i32 }
@TIOCSWINSZ = global i32 0
define i32 @tcsetwinsize(i32 %0, %struct.winsize* %1) {
%3 = load i32, i32* @TIOCSWINSZ
%4 = tail call i32 @syscall(i32 54, i32 %0, i32 %3, %struct.winsize* %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *stSafeCMalloc(size_t);
void *stSafeCCalloc(size_t size) {
  void *mem = stSafeCMalloc(size);
  memset(mem, 0, size);
  return mem;
}


x86 assembly (clang, -O0):
<stSafeCCalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <stSafeCMalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stSafeCCalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <stSafeCMalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @stSafeCCalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @stSafeCMalloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i64, i64* %2
%8 = call i32 @memset(i8* %6, i32 0, i64 %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
define i8* @stSafeCCalloc(i64 %0) {
%2 = tail call i8* @stSafeCMalloc(i64 %0)
%3 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
ret i8* %2
}
void func5() {
  char var_5[16];
  var_5[15] = 0x5;
}


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

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

LLVM IR (-O0):
define void @func5() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 15
store i8 5, i8* %2
ret void
}

LLVM IR (-O2):
define void @func5() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(char *, char *, char *);
void function_name(char *name) {
  write("msproject.xml", "\t<Name>%s</Name>\n", name);
}


x86 assembly (clang, -O0):
<function_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xee0(%rip),%rsi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function_name>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xeed(%rip),%rsi
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"msproject.xml\00"
@.str.1 = [18 x i8] c"\09<Name>%s</Name>\0A\00"
define void @function_name(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @write(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"msproject.xml\00"
@.str.1 = [18 x i8] c"\09<Name>%s</Name>\0A\00"
define void @function_name(i8* %0) {
%2 = tail call i32 @write(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void precisionerror() {
  fprintf(stderr,
          "Try increasing the area criterion and/or reducing the minimum\n");
  fprintf(stderr,
          "  allowable angle so that tiny triangles are not created.\n");
}


x86 assembly (clang, -O0):
<precisionerror>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xf06(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<precisionerror>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf10(%rip),%rsi
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [63 x i8] c"Try increasing the area criterion and/or reducing the minimum\0A\00"
@.str.1 = [59 x i8] c" allowable angle so that tiny triangles are not created.\0A\00"
define void @precisionerror() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [63 x i8] c"Try increasing the area criterion and/or reducing the minimum\0A\00"
@.str.1 = [59 x i8] c" allowable angle so that tiny triangles are not created.\0A\00"
define void @precisionerror() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void UARTFIFOLevelGet(uint32_t ui32Base, uint32_t *pui32TxLevel,
                      uint32_t *pui32RxLevel) {
  uint32_t ui32Temp;
  ;
  ui32Temp = (*((volatile uint32_t *)(ui32Base + 0x00000034)));
  *pui32TxLevel = ui32Temp & 0x00000007;
  *pui32RxLevel = ui32Temp & 0x00000038;
}


x86 assembly (clang, -O0):
<UARTFIFOLevelGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
add    $0x34,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%ecx
and    $0x7,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
and    $0x38,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTFIFOLevelGet>:
movslq %edi,%rax
mov    0x34(%rax),%eax
mov    %eax,%ecx
and    $0x7,%ecx
mov    %ecx,(%rsi)
and    $0x38,%eax
mov    %eax,(%rdx)
ret

LLVM IR (-O0):
define void @UARTFIFOLevelGet(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 52
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = and i32 %13, 7
%15 = load i32*, i32** %5
store i32 %14, i32* %15
%16 = load i32, i32* %7
%17 = and i32 %16, 56
%18 = load i32*, i32** %6
store i32 %17, i32* %18
ret void
}

LLVM IR (-O2):
define void @UARTFIFOLevelGet(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = add nsw i32 %0, 52
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = and i32 %7, 7
store i32 %8, i32* %1
%9 = and i32 %7, 56
store i32 %9, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ iDoRemoteFunc(unsigned char *, unsigned int, int);
char *malloc(int);
unsigned int sprintf(char *, char *, int);
void vRcTsFingerprintClose(void) {
  unsigned int uiDataLen;
  char *psFunCall = malloc(100);
  uiDataLen = sprintf(psFunCall, "%u()", 4102);
  iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
}


x86 assembly (clang, -O0):
<vRcTsFingerprintClose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x1006,%edx
call   1060 <sprintf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x1,%edx
call   1050 <iDoRemoteFunc@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vRcTsFingerprintClose>:
push   %rbx
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xeab(%rip),%rsi
mov    %rax,%rdi
mov    $0x1006,%edx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   1050 <iDoRemoteFunc@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%u()\00"
define void @vRcTsFingerprintClose() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i8* @malloc(i32 100)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4102)
store i32 %5, i32* %1
%6 = load i8*, i8** %2
%7 = load i32, i32* %1
%8 = call i32 @iDoRemoteFunc(i8* %6, i32 %7, i32 1)
%9 = load i8*, i8** %2
%10 = call i32 @free(i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%u()\00"
define void @vRcTsFingerprintClose() {
%1 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%2 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4102)
%3 = tail call i32 @iDoRemoteFunc(i8* %1, i32 %2, i32 1)
%4 = tail call i32 @free(i8* %1)
ret void
}
/* Type definitions */
struct timeval {
  int tv_usec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int clock();
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int gettimeofday(struct timeval *tv, void *tz_unused __attribute__((unused))) {
  tv->tv_sec = time(NULL);
  tv->tv_usec = clock() * 1000000 / 1000;
  return 0;
}


x86 assembly (clang, -O0):
<gettimeofday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    $0x0,%al
call   1030 <clock@plt>
imul   $0xf4240,%eax,%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettimeofday>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rbx)
xor    %eax,%eax
call   1030 <clock@plt>
imul   $0x3e8,%eax,%eax
mov    %eax,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @gettimeofday(%struct.timeval* %0, i8* %1) {
%3 = alloca %struct.timeval*
%4 = alloca i8*
store %struct.timeval* %0, %struct.timeval** %3
store i8* %1, i8** %4
%5 = call i32 @time(i32* null)
%6 = load %struct.timeval*, %struct.timeval** %3
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
store i32 %5, i32* %7
%8 = call i32 (...) @clock()
%9 = mul nsw i32 %8, 1000000
%10 = sdiv i32 %9, 1000
%11 = load %struct.timeval*, %struct.timeval** %3
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
store i32 %10, i32* %12
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @gettimeofday(%struct.timeval* nocapture writeonly %0, i8* nocapture readnone %1) {
%3 = tail call i32 @time(i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
store i32 %3, i32* %4
%5 = tail call i32 (...) @clock()
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
store i32 %6, i32* %7
ret i32 0
}
/* Variables and functions */
int syscall(int, char, int /*<<< orphan*/, int /*<<< orphan*/);
int putc(char c) { return syscall(91, c, 0, 0); }


x86 assembly (clang, -O0):
<putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x5b,%edi
xor    %ecx,%ecx
movsbl -0x1(%rbp),%esi
mov    %ecx,%edx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putc>:
mov    %edi,%esi
mov    $0x5b,%edi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define i32 @putc(i8 signext %0) {
%2 = tail call i32 @syscall(i32 91, i8 signext %0, i32 0, i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG3(char *, int);
int Do_unlock(int fd) {
  int code = -2;
  DEBUG3("Do_unlock: fd %d", fd);
  DEBUG3("Do_unlock: status %d", code);
  return (code);
}


x86 assembly (clang, -O0):
<Do_unlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xfffffffe,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed4(%rip),%rdi
call   1030 <DEBUG3@plt>
mov    -0x8(%rbp),%esi
lea    0xed6(%rip),%rdi
call   1030 <DEBUG3@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Do_unlock>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <DEBUG3@plt>
lea    0xeeb(%rip),%rdi
mov    $0xfffffffe,%esi
call   1030 <DEBUG3@plt>
mov    $0xfffffffe,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Do_unlock: fd %d\00"
@.str.1 = [21 x i8] c"Do_unlock: status %d\00"
define i32 @Do_unlock(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 -2, i32* %3
%4 = load i32, i32* %2
%5 = call i32 @DEBUG3(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %3
%7 = call i32 @DEBUG3(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
@.str = [17 x i8] c"Do_unlock: fd %d\00"
@.str.1 = [21 x i8] c"Do_unlock: status %d\00"
define i32 @Do_unlock(i32 %0) {
%2 = tail call i32 @DEBUG3(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @DEBUG3(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 -2)
ret i32 -2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *progname) {
  fprintf(stderr, "Usage: %s [-p pid_file] [-f fifo_cmd]\n", progname);
  exit(0);
}


x86 assembly (clang, -O0):
<usage>:
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>
xor    %edi,%edi
call   1040 <exit@plt>

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"Usage: %s [-p pid_file] [-f fifo_cmd]\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ destroy();
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ init_colors();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ raw();
int /*<<< orphan*/ run_game();
int /*<<< orphan*/ run_splash();
int main() {
  initscr();
  raw();
  noecho();
  init_colors();
  run_splash();
  run_game();
  destroy();
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
mov    $0x0,%al
call   1050 <raw@plt>
mov    $0x0,%al
call   1090 <noecho@plt>
mov    $0x0,%al
call   10a0 <init_colors@plt>
mov    $0x0,%al
call   1030 <run_splash@plt>
mov    $0x0,%al
call   1070 <run_game@plt>
mov    $0x0,%al
call   1060 <destroy@plt>
mov    $0x0,%al
call   1080 <endwin@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <initscr@plt>
xor    %eax,%eax
call   1050 <raw@plt>
xor    %eax,%eax
call   1090 <noecho@plt>
xor    %eax,%eax
call   10a0 <init_colors@plt>
xor    %eax,%eax
call   1030 <run_splash@plt>
xor    %eax,%eax
call   1070 <run_game@plt>
xor    %eax,%eax
call   1060 <destroy@plt>
xor    %eax,%eax
call   1080 <endwin@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @initscr()
%3 = call i32 (...) @raw()
%4 = call i32 (...) @noecho()
%5 = call i32 (...) @init_colors()
%6 = call i32 (...) @run_splash()
%7 = call i32 (...) @run_game()
%8 = call i32 (...) @destroy()
%9 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @raw()
%3 = tail call i32 (...) @noecho()
%4 = tail call i32 (...) @init_colors()
%5 = tail call i32 (...) @run_splash()
%6 = tail call i32 (...) @run_game()
%7 = tail call i32 (...) @destroy()
%8 = tail call i32 (...) @endwin()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ foo(void *);
char gcharxor(char x, char y) {
  x ^= y;
  if (!x)
    foo((void *)0);
  return x;
}


x86 assembly (clang, -O0):
<gcharxor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%ecx
movsbl -0x1(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x1(%rbp)
cmpb   $0x0,-0x1(%rbp)
jne    1144 <gcharxor+0x34>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <foo@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcharxor>:
push   %rbx
mov    %edi,%ebx
xor    %esi,%ebx
test   %bl,%bl
jne    1120 <gcharxor+0x10>
xor    %edi,%edi
call   1030 <foo@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @gcharxor(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = xor i32 %8, %6
%10 = trunc i32 %9 to i8
store i8 %10, i8* %3
%11 = load i8, i8* %3
%12 = icmp ne i8 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %2
%14 = call i32 @foo(i8* null)
br label %15
15: ; preds = %13, %2
%16 = load i8, i8* %3
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @gcharxor(i8 signext %0, i8 signext %1) {
%3 = xor i8 %1, %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @foo(i8* null)
br label %7
7: ; preds = %5, %2
ret i8 %3
}
unsigned long esp() {
  unsigned long a = 0;
  __asm__("\tmov %%rsp, %%rax\n" : "=a"(a));
  printf("%%rsp %lx\n", a);
  return a;
}


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

x86 assembly (clang, -O2):
<esp>:
push   %rbx
mov    %rsp,%rax
mov    %rax,%rbx
lea    0xee2(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%%rsp %lx\0A\00"
define i64 @esp() {
%1 = alloca i64
store i64 0, i64* %1
%2 = call i64 asm "\09mov %rsp, %rax\0A", "={ax},~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = load i64, i64* %1
ret i64 %5
}

LLVM IR (-O2):
@.str = [11 x i8] c"%%rsp %lx\0A\00"
define i64 @esp() {
%1 = tail call i64 asm "\09mov %rsp, %rax\0A", "={ax},~{dirflag},~{fpsr},~{flags}"()
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %1)
ret i64 %1
}
/* Variables and functions */
long long PAPI_get_real_cyc();
void papif_get_real_cyc(long long *real_cyc) {
  *real_cyc = PAPI_get_real_cyc();
}


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

x86 assembly (clang, -O2):
<papif_get_real_cyc>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <PAPI_get_real_cyc@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @papif_get_real_cyc(i64* nocapture writeonly %0) {
%2 = tail call i64 (...) @PAPI_get_real_cyc()
store i64 %2, i64* %0
ret void
}
int AcquireLock(int sock, int fail_on_intr) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @AcquireLock(i32 %0, i32 %1) {
ret i32 0
}
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ rcx;

/* Variables and functions */
int /*<<< orphan*/ cpuid(int, int *, int *, int *, int *);
bool cpuid_therm_stat_therm_thresh() {
  uint64_t rax, rbx, rcx, rdx;
  int leaf = 1;
  cpuid(leaf, &rax, &rbx, &rcx, &rdx);
  if ((((uint64_t)(rcx) &
        ((((uint64_t)1 << (((8)) - ((8)) + 1)) - 1) << ((8)))) >>
       (8)) == 1) {
    return true;
  } else {
    return false;
  }
}


x86 assembly (clang, -O0):
<cpuid_therm_stat_therm_thresh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <cpuid@plt>
mov    -0x10(%rbp),%eax
and    $0x100,%eax
sar    $0x8,%eax
cmp    $0x1,%eax
jne    1157 <cpuid_therm_stat_therm_thresh+0x47>
movl   $0x1,-0x4(%rbp)
jmp    115e <cpuid_therm_stat_therm_thresh+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_therm_stat_therm_thresh>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    $0x1,%edi
call   1030 <cpuid@plt>
mov    0x8(%rsp),%eax
shr    $0x8,%eax
and    $0x1,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @cpuid_therm_stat_therm_thresh() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @cpuid(i32 1, i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %3
%11 = lshr i32 %10, 8
%12 = and i32 %11, 1
ret i32 %12
}
/* Type definitions */
struct config {
  int dummy;
};

/* Variables and functions */
struct config *config_index_find(char const *, int /*<<< orphan*/);
struct config *config_find_section(const char *section) {
  return config_index_find(section, 0);
}


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

x86 assembly (clang, -O2):
<config_find_section>:
xor    %esi,%esi
jmp    1030 <config_index_find@plt>

LLVM IR (-O0):
%struct.config = type { i32 }
define %struct.config* @config_find_section(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call %struct.config* @config_index_find(i8* %3, i32 0)
ret %struct.config* %4
}

LLVM IR (-O2):
%struct.config = type { i32 }
define %struct.config* @config_find_section(i8* %0) {
%2 = tail call %struct.config* @config_index_find(i8* %0, i32 0)
ret %struct.config* %2
}
void module_close(void *dll) {}


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

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

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

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