xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isxdigit(int);
void t_isxdigit_0x4c() {
  Assert_real((isxdigit(76) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isxdigit.c",
              385, ("isxdigit should be 0 for L"));
}


x86 assembly (clang, -O0):
<t_isxdigit_0x4c>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4c,%edi
call   1030 <isxdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x181,%edx
lea    0xf5c(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isxdigit_0x4c>:
push   %rax
mov    $0x4c,%edi
call   1030 <isxdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x181,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isxdigit.c\00"
@.str.1 = [27 x i8] c"isxdigit should be 0 for L\00"
define void @t_isxdigit_0x4c() {
%1 = call i64 @isxdigit(i32 76)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 385, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isxdigit.c\00"
@.str.1 = [27 x i8] c"isxdigit should be 0 for L\00"
define void @t_isxdigit_0x4c() {
%1 = tail call i64 @isxdigit(i32 76)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 385, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
scalar_t__ scanner(char const *);
int main() {
  const char *str =
      "LinkList* LinkList_Create() // O(1){  <1> (2)  TLinkList* ret = "
      "(TLinkList*)malloc(sizeof(TLinkList));    if( ret != NULL )    {        "
      "r    et-len    gth = 0;        ret-header.next = NULL;    }    return "
      "ret;}void LinkList_Destroy(LinkList* list) // O(1){    free(list);}";
  if (scanner(str))
    printf("main return.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <scanner@plt>
cmp    $0x0,%rax
je     1159 <main+0x39>
lea    0xfbe(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <scanner@plt>
test   %rax,%rax
je     113e <main+0x1e>
lea    0xfd9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [274 x i8] c"LinkList* LinkList_Create() // O(1){ <1> (2) TLinkList* ret = (TLinkList*)malloc(sizeof(TLinkList)); if( ret != NULL ) { r et-len gth = 0; ret-header.next = NULL; } return ret;}void LinkList_Destroy(LinkList* list) // O(1){ free(list);}\00"
@.str.1 = [14 x i8] c"main return.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([274 x i8], [274 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @scanner(i8* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [274 x i8] c"LinkList* LinkList_Create() // O(1){ <1> (2) TLinkList* ret = (TLinkList*)malloc(sizeof(TLinkList)); if( ret != NULL ) { r et-len gth = 0; ret-header.next = NULL; } return ret;}void LinkList_Destroy(LinkList* list) // O(1){ free(list);}\00"
@str = [13 x i8] c"main return.\00"
define i32 @main() {
%1 = tail call i64 @scanner(i8* getelementptr inbounds ([274 x i8], [274 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
int strlen(char *);
int vby_encode(char *, int);
int vby_encode_s(char *buf, char *s) {
  int ln = strlen(s);
  int nb = vby_encode(buf, ln);
  memcpy(buf + nb, s, ln);
  return ln + nb;
}


x86 assembly (clang, -O0):
<vby_encode_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <vby_encode@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vby_encode_s>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <vby_encode@plt>
movslq %eax,%rbp
add    %rbp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1050 <memcpy@plt>
add    %r15d,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @vby_encode_s(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @vby_encode(i8* %0, i32 %3)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = tail call i32 @memcpy(i8* %6, i8* %1, i32 %3)
%8 = add nsw i32 %4, %3
ret i32 %8
}
int execute_reboot() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_reboot() {
ret i32 0
}
int LSB(long word) {
  long dummy, dummy2;
  asm("          bsfq    %1, %0     "
      "\n\t"
      "          jnz     1f         "
      "\n\t"
      "          movq    $64, %0    "
      "\n\t"
      "1:                           "
      "\n\t"
      : "=&r"(dummy), "=&r"(dummy2)
      : "1"((long)(word))
      : "cc");
  return (dummy);
}


x86 assembly (clang, -O0):
<LSB>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
bsf    %rax,%rcx
jne    111d <LSB+0x1d>
mov    $0x40,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LSB>:
bsf    %rdi,%rax
jne    110d <LSB+0xd>
mov    $0x40,%rax
ret

LLVM IR (-O0):
define i32 @LSB(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = call { i64, i64 } asm " bsfq $1, $0 \0A\09 jnz 1f \0A\09 movq $$64, $0 \0A\091: \0A\09", "=&r,=&r,1,~{cc},~{dirflag},~{fpsr},~{flags}"(i64 %5)
%7 = extractvalue { i64, i64 } %6, 0
%8 = extractvalue { i64, i64 } %6, 1
store i64 %7, i64* %3
store i64 %8, i64* %4
%9 = load i64, i64* %3
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @LSB(i64 %0) {
%2 = tail call { i64, i64 } asm " bsfq $1, $0 \0A\09 jnz 1f \0A\09 movq $$64, $0 \0A\091: \0A\09", "=&r,=&r,1,~{cc},~{dirflag},~{fpsr},~{flags}"(i64 %0)
%3 = extractvalue { i64, i64 } %2, 0
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
unsigned int atoi(char *);
int count(void *user_data, int tuplesCount, char **argv, char **azColName) {
  unsigned int c = atoi(argv[0]);
  *((unsigned int *)user_data) = c;
  return 0;
}


x86 assembly (clang, -O0):
<count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @count(i8* %0, i32 %1, i8** %2, i8** %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i8** %3, i8*** %8
%10 = load i8**, i8*** %7
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %9
%14 = load i32, i32* %9
%15 = load i8*, i8** %5
%16 = bitcast i8* %15 to i32*
store i32 %14, i32* %16
ret i32 0
}

LLVM IR (-O2):
define i32 @count(i8* nocapture writeonly %0, i32 %1, i8** nocapture %2, i8** nocapture readnone %3) {
%5 = load i8*, i8** %2
%6 = tail call i32 @atoi(i8* %5)
%7 = bitcast i8* %0 to i32*
store i32 %6, i32* %7
ret i32 0
}
int ddsGetFourCC(unsigned const char *buffer) {
  return (buffer[84] & 0xFF) << 24 | (buffer[85] & 0xFF) << 16 |
         (buffer[86] & 0xFF) << 8 | (buffer[87] & 0xFF);
}


x86 assembly (clang, -O0):
<ddsGetFourCC>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x54(%rax),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x55(%rcx),%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x56(%rcx),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x57(%rcx),%ecx
and    $0xff,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ddsGetFourCC>:
mov    0x54(%rdi),%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @ddsGetFourCC(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 84
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = and i32 %6, 255
%8 = shl i32 %7, 24
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 85
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = and i32 %12, 255
%14 = shl i32 %13, 16
%15 = or i32 %8, %14
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i64 86
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = and i32 %19, 255
%21 = shl i32 %20, 8
%22 = or i32 %15, %21
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i64 87
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = and i32 %26, 255
%28 = or i32 %22, %27
ret i32 %28
}

LLVM IR (-O2):
define i32 @ddsGetFourCC(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 84
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = shl nuw i32 %4, 24
%6 = getelementptr inbounds i8, i8* %0, i64 85
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = shl nuw nsw i32 %8, 16
%10 = or i32 %9, %5
%11 = getelementptr inbounds i8, i8* %0, i64 86
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl nuw nsw i32 %13, 8
%15 = or i32 %10, %14
%16 = getelementptr inbounds i8, i8* %0, i64 87
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = or i32 %15, %18
ret i32 %19
}
void split_string_free(char **tokens, int count) {
  int i;
  for (i = 0; i < count; i++) {
    if (tokens[i])
      free(tokens[i]);
  }
  free(tokens);
}


x86 assembly (clang, -O0):
<split_string_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1169 <split_string_free+0x59>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1156 <split_string_free+0x46>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
jmp    115b <split_string_free+0x4b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <split_string_free+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<split_string_free>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1149 <split_string_free+0x39>
mov    %esi,%r15d
xor    %ebx,%ebx
jmp    1139 <split_string_free+0x29>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
cmp    %rbx,%r15
je     1149 <split_string_free+0x39>
mov    (%r14,%rbx,8),%rdi
test   %rdi,%rdi
je     1130 <split_string_free+0x20>
call   1030 <free@plt>
jmp    1130 <split_string_free+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @split_string_free(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %12
%7 = phi i64 [ 0, %4 ], [ %13, %12 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %6
tail call void @free(i8* %9)
br label %12
12: ; preds = %6, %11
%13 = add nuw nsw i64 %7, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %15, label %6
15: ; preds = %12, %2
%16 = bitcast i8** %0 to i8*
tail call void @free(i8* %16)
ret void
}
int test2() {
  int *x = 0;
  int y;
  int z;
  int h;
  asm("cpuid " : "=a"(x), "=b"(y), "=c"(z), "=d"(h) : "0"(0));
  return *x;
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
cpuid
mov    %rax,-0x10(%rbp)
mov    %ebx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
push   %rbx
xor    %eax,%eax
cpuid
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test2() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32* null, i32** %1
%5 = call { i32*, i32, i32, i32 } asm "cpuid ", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i64 0)
%6 = extractvalue { i32*, i32, i32, i32 } %5, 0
%7 = extractvalue { i32*, i32, i32, i32 } %5, 1
%8 = extractvalue { i32*, i32, i32, i32 } %5, 2
%9 = extractvalue { i32*, i32, i32, i32 } %5, 3
store i32* %6, i32** %1
store i32 %7, i32* %2
store i32 %8, i32* %3
store i32 %9, i32* %4
%10 = load i32*, i32** %1
%11 = load i32, i32* %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @test2() {
%1 = tail call { i32*, i32, i32, i32 } asm "cpuid ", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i64 0)
%2 = extractvalue { i32*, i32, i32, i32 } %1, 0
%3 = load i32, i32* %2
ret i32 %3
}
int fun421() { return 421; }


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

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

LLVM IR (-O0):
define i32 @fun421() {
ret i32 421
}

LLVM IR (-O2):
define i32 @fun421() {
ret i32 421
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int x;
  long int y;
  printf("size of int: %d\n", sizeof x);
  printf("size of short: %d\n", sizeof y);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"size of int: %d\0A\00"
@.str.1 = [19 x i8] c"size of short: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 4)
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 8)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"size of int: %d\0A\00"
@.str.1 = [19 x i8] c"size of short: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 8)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
scalar_t__ smbw_fd(int);
int /*<<< orphan*/ smbw_write(int, void *, size_t);
int /*<<< orphan*/ stub1(int, void *, size_t);
ssize_t writex(int fd, void *buf, size_t count,
               ssize_t (*f)(int, void *, size_t)) {
  if (smbw_fd(fd)) {
    return smbw_write(fd, buf, count);
  }
  return (*f)(fd, buf, count);
}


x86 assembly (clang, -O0):
<writex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <smbw_fd@plt>
cmp    $0x0,%rax
je     1161 <writex+0x41>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <smbw_write@plt>
mov    %eax,-0x4(%rbp)
jmp    1175 <writex+0x55>
mov    -0x20(%rbp),%rax
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   *%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writex>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <smbw_fd@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
test   %rax,%rax
je     1153 <writex+0x33>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <smbw_write@plt>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    *%rax

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

LLVM IR (-O2):
define i32 @writex(i32 %0, i8* %1, i64 %2, i32 (i32, i8*, i64)* nocapture %3) {
%5 = tail call i64 @smbw_fd(i32 %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @smbw_write(i32 %0, i8* %1, i64 %2)
br label %11
9: ; preds = %4
%10 = tail call i32 %3(i32 %0, i8* %1, i64 %2)
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ %8, %7 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ PutGeneric256(int, int, int, int, unsigned char *);
void PutTile(int x, int y, unsigned char *p) { PutGeneric256(x, y, 8, 8, p); }


x86 assembly (clang, -O0):
<PutTile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%r8
mov    $0x8,%ecx
mov    %ecx,%edx
call   1030 <PutGeneric256@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PutTile>:
mov    %rdx,%r8
mov    $0x8,%edx
mov    $0x8,%ecx
jmp    1030 <PutGeneric256@plt>

LLVM IR (-O0):
define void @PutTile(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = call i32 @PutGeneric256(i32 %7, i32 %8, i32 8, i32 8, i8* %9)
ret void
}

LLVM IR (-O2):
define void @PutTile(i32 %0, i32 %1, i8* %2) {
%4 = tail call i32 @PutGeneric256(i32 %0, i32 %1, i32 8, i32 8, i8* %2)
ret void
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
void *_my_malloc(int size) {
  void *temp;
  char fail[256];
  temp = malloc(size);
  if (((void *)0) == temp) {
    sprintf(fail, "malloc: out of memory.  block size: %d\n", size);
    ;
  }
  return temp;
}


x86 assembly (clang, -O0):
<_my_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    115c <_my_malloc+0x3c>
lea    -0x110(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xea9(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_my_malloc>:
push   %rbp
push   %rbx
sub    $0x108,%rsp
mov    %edi,%ebp
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1149 <_my_malloc+0x29>
lea    0xec1(%rip),%rsi
mov    %rsp,%rdi
mov    %ebp,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rax
add    $0x108,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"malloc: out of memory. block size: %d\0A\00"
define i8* @_my_malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [256 x i8]
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i8* @malloc(i32 %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp eq i8* null, %7
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%11 = load i32, i32* %2
%12 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %9, %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@.str = [40 x i8] c"malloc: out of memory. block size: %d\0A\00"
define noalias i8* @_my_malloc(i32 %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = tail call i8* @malloc(i32 %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %8
8: ; preds = %6, %1
ret i8* %4
}
char *strcpy(char *destination, const char *source) {
  char *olddst = destination;
  while (*source) {
    *destination = *source;
    destination++;
    source++;
  }
  return olddst;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114a <strcpy+0x4a>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1120 <strcpy+0x20>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rax,%rdx,1)
movzbl 0x1(%rsi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = phi i8* [ %10, %5 ], [ %1, %2 ]
store i8 %6, i8* %7
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
ret i8* %0
}
int toi_activate_storage(int force) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @toi_activate_storage(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ is_digit(char);
int is_integer(char *s) {
  int i = 0;
  while (s[i] != '0') {
    if (!is_digit(s[i]))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
je     1163 <is_integer+0x53>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <is_digit@plt>
cmp    $0x0,%eax
jne    115e <is_integer+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    116a <is_integer+0x5a>
jmp    1123 <is_integer+0x13>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_integer>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx),%eax
cmp    $0x30,%al
je     1137 <is_integer+0x27>
movsbl %al,%edi
call   1030 <is_digit@plt>
test   %eax,%eax
jne    1120 <is_integer+0x10>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @is_integer(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 48
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @is_digit(i8 signext %3)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %2
8: ; preds = %2, %5
%9 = phi i32 [ 0, %5 ], [ 1, %2 ]
ret i32 %9
}
int exe$find(struct _fab *fab, void *err, void *suc) {
  printk("not implemented\n");
}


x86 assembly (clang, -O0):
<exe$find>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exe$find>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printk@plt>

LLVM IR (-O0):
%struct._fab = type opaque
@.str = [17 x i8] c"not implemented\0A\00"
define i32 @"exe$find"(%struct._fab* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct._fab*
%6 = alloca i8*
%7 = alloca i8*
store %struct._fab* %0, %struct._fab** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @printk to i32 (i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
%struct._fab = type opaque
@.str = [17 x i8] c"not implemented\0A\00"
define i32 @"exe$find"(%struct._fab* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @printk to i32 (i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
void RTHeapOffsetAlloc(void) {}


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

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

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

LLVM IR (-O2):
define void @RTHeapOffsetAlloc() {
ret void
}
const char *get_psy_version(void) {
  static const char *const str = "PSY_MAJOR_VERSION"
                                 "."
                                 "PSY_MINOR_VERSION";
  return str;
}


x86 assembly (clang, -O0):
<get_psy_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_psy_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@get_psy_version.str = internal constant i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i32 0, i32 0)
@.str = [36 x i8] c"PSY_MAJOR_VERSION.PSY_MINOR_VERSION\00"
define i8* @get_psy_version() {
ret i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i32 0, i32 0)
}

LLVM IR (-O2):
@.str = [36 x i8] c"PSY_MAJOR_VERSION.PSY_MINOR_VERSION\00"
define i8* @get_psy_version() {
ret i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int main(void) {
  char words[81];
  puts("Enter a string, please.");
  gets(words);
  printf("Your string twice:\n");
  printf("%s\n", words);
  puts(words);
  puts("Done.");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
lea    -0x60(%rbp),%rdi
call   1050 <gets@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <gets@plt>
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Enter a string, please.\00"
@.str.1 = [20 x i8] c"Your string twice:\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [6 x i8] c"Done.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [81 x i8]
store i32 0, i32* %1
%3 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%10 = call i32 @puts(i8* %9)
%11 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Enter a string, please.\00"
@.str.3 = [6 x i8] c"Done.\00"
@str = [19 x i8] c"Your string twice:\00"
define i32 @main() {
%1 = alloca [81 x i8]
%2 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%6 = call i32 @puts(i8* %2)
%7 = call i32 @puts(i8* %2)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
char const *strerror(int /*<<< orphan*/);
const char *serial_error_string(ssize_t code) { return strerror(-code); }


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

x86 assembly (clang, -O2):
<serial_error_string>:
neg    %edi
jmp    1030 <strerror@plt>

LLVM IR (-O0):
define i8* @serial_error_string(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 0, %3
%5 = call i8* @strerror(i32 %4)
ret i8* %5
}

LLVM IR (-O2):
define i8* @serial_error_string(i32 %0) {
%2 = sub nsw i32 0, %0
%3 = tail call i8* @strerror(i32 %2)
ret i8* %3
}
/* Type definitions */
struct list_head_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __list_splice(struct list_head_t *, struct list_head_t *);
int /*<<< orphan*/ list_empty(struct list_head_t *);
void list_splice(struct list_head_t *list, struct list_head_t *head) {
  if (!list_empty(list))
    __list_splice(list, head);
}


x86 assembly (clang, -O0):
<list_splice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <list_empty@plt>
cmp    $0x0,%eax
jne    114f <list_splice+0x2f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <__list_splice@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.list_head_t = type { i32 }
define void @list_splice(%struct.list_head_t* %0, %struct.list_head_t* %1) {
%3 = alloca %struct.list_head_t*
%4 = alloca %struct.list_head_t*
store %struct.list_head_t* %0, %struct.list_head_t** %3
store %struct.list_head_t* %1, %struct.list_head_t** %4
%5 = load %struct.list_head_t*, %struct.list_head_t** %3
%6 = call i32 @list_empty(%struct.list_head_t* %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load %struct.list_head_t*, %struct.list_head_t** %3
%10 = load %struct.list_head_t*, %struct.list_head_t** %4
%11 = call i32 @__list_splice(%struct.list_head_t* %9, %struct.list_head_t* %10)
br label %12
12: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
%struct.list_head_t = type { i32 }
define void @list_splice(%struct.list_head_t* %0, %struct.list_head_t* %1) {
%3 = tail call i32 @list_empty(%struct.list_head_t* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @__list_splice(%struct.list_head_t* %0, %struct.list_head_t* %1)
br label %7
7: ; preds = %5, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ STDIN_FILENO;
int errno;
int read(int /*<<< orphan*/, int /*<<< orphan*/ *, int);
int __attribute__((unused)) read_byte(uint8_t *c) {
  int rc = read(STDIN_FILENO, c, 1);
  if (rc < 0)
    return -errno;
  return rc;
}


x86 assembly (clang, -O0):
<read_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1153 <read_byte+0x43>
xor    %eax,%eax
mov    0x2e97(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <read_byte+0x49>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_byte>:
push   %rax
mov    %rdi,%rsi
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%edx
call   1030 <read@plt>
mov    0x2eb2(%rip),%rcx
xor    %edx,%edx
sub    (%rcx),%edx
test   %eax,%eax
cmovs  %edx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@errno = global i32 0
define i32 @read_byte(i32* nocapture %0) {
%2 = load i32, i32* @STDIN_FILENO
%3 = tail call i32 @read(i32 %2, i32* %0, i32 1)
%4 = icmp slt i32 %3, 0
%5 = load i32, i32* @errno
%6 = sub nsw i32 0, %5
%7 = select i1 %4, i32 %6, i32 %3
ret i32 %7
}
/* Variables and functions */
double exp(double);
double Sigmoid(double input) { return 1.0 / (1.0 + exp(-input)); }


x86 assembly (clang, -O0):
<Sigmoid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  0xeba(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xeae(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sigmoid>:
push   %rax
xorpd  0xee7(%rip),%xmm0
call   1030 <exp@plt>
movsd  0xeea(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @Sigmoid(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fneg double %3
%5 = call double @exp(double %4)
%6 = fadd double 1.000000e+00, %5
%7 = fdiv double 1.000000e+00, %6
ret double %7
}

LLVM IR (-O2):
define double @Sigmoid(double %0) {
%2 = fneg double %0
%3 = tail call double @exp(double %2)
%4 = fadd double %3, 1.000000e+00
%5 = fdiv double 1.000000e+00, %4
ret double %5
}
char mod26(char a) { return (a + 26) % 26; }


x86 assembly (clang, -O0):
<mod26>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x1a,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %dl,%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod26>:
lea    0x1a(%rdi),%eax
imul   $0x4ec5,%eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x13,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
ret

LLVM IR (-O0):
define signext i8 @mod26(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = add nsw i32 %4, 26
%6 = srem i32 %5, 26
%7 = trunc i32 %6 to i8
ret i8 %7
}

LLVM IR (-O2):
define signext i8 @mod26(i8 signext %0) {
%2 = sext i8 %0 to i16
%3 = add nsw i16 %2, 26
%4 = srem i16 %3, 26
%5 = trunc i16 %4 to i8
ret i8 %5
}
__attribute__((hot)) int sr_cmpany(char *prefix, int prefixsz, char *key,
                                   int keysz, void *arg) {
  (void)prefix;
  (void)prefixsz;
  (void)key;
  (void)keysz;
  (void)arg;
  return 0;
}


x86 assembly (clang, -O0):
<sr_cmpany>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sr_cmpany>:
xor    %eax,%eax
ret
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)

LLVM IR (-O0):
define i32 @sr_cmpany(i8* %0, i32 %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i8*, i8** %8
%14 = load i32, i32* %9
%15 = load i8*, i8** %10
ret i32 0
}

LLVM IR (-O2):
define i32 @sr_cmpany(i8* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i32 %3, i8* nocapture readnone %4) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void main() {
  int a = 3, b = 5;
  printf("%d", a + b * a + b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%eax
imul   -0x4(%rbp),%eax
add    %eax,%esi
add    -0x8(%rbp),%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
mov    $0x17,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 23)
ret void
}
/* Variables and functions */
int missingNumber(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a[] = {0, 1, 3};
  printf("%d\n", missingNumber(a, 3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1040 <missingNumber@plt>
mov    %eax,%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xede(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xecb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x3,%esi
call   1040 <missingNumber@plt>
lea    0xebc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [3 x i32] [i32 0, i32 1, i32 3]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
store i32 0, i32* %1
%3 = bitcast [3 x i32]* %2 to i8*
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%5 = call i32 @missingNumber(i32* %4, i32 3)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [3 x i32] [i32 0, i32 1, i32 3]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32 @missingNumber(i32* %3, i32 3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
int *herwig6_addressl_(int *arg) { return arg; }


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

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

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

LLVM IR (-O2):
define i32* @herwig6_addressl_(i32* readnone returned %0) {
ret i32* %0
}