; LLVM IR from trustwallet/wallet-core :: trezor-crypto/crypto (nem)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.nem_transaction_ctx = type { [32 x i8], ptr, i64, i64 }

@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @nem_transaction_write_common(ptr noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i64 noundef, i32 noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @nem_write_u32(ptr noundef, i32 noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @nem_write_tagged(ptr noundef, ptr noundef, i32 noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @nem_write_u64(ptr noundef, i64 noundef) #5

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @nem_transaction_create_mosaic_creation(ptr noundef %0, i8 noundef zeroext %1, i32 noundef %2, ptr noundef %3, i64 noundef %4, i32 noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, i32 noundef %9, i64 noundef %10, i1 noundef zeroext %11, i1 noundef zeroext %12, i32 noundef %13, i64 noundef %14, ptr noundef %15, ptr noundef %16, ptr noundef %17, ptr noundef %18, i64 noundef %19) #4 {
  %21 = alloca i1, align 1
  %22 = alloca ptr, align 8
  %23 = alloca i8, align 1
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  %26 = alloca i64, align 8
  %27 = alloca i32, align 4
  %28 = alloca ptr, align 8
  %29 = alloca ptr, align 8
  %30 = alloca ptr, align 8
  %31 = alloca i32, align 4
  %32 = alloca i64, align 8
  %33 = alloca i8, align 1
  %34 = alloca i8, align 1
  %35 = alloca i32, align 4
  %36 = alloca i64, align 8
  %37 = alloca ptr, align 8
  %38 = alloca ptr, align 8
  %39 = alloca ptr, align 8
  %40 = alloca ptr, align 8
  %41 = alloca i64, align 8
  %42 = alloca i8, align 1
  %43 = alloca i32, align 4
  %44 = alloca i64, align 8
  %45 = alloca i64, align 8
  %46 = alloca i64, align 8
  %47 = alloca %struct.nem_transaction_ctx, align 8
  %48 = alloca i64, align 8
  %49 = alloca i64, align 8
  %50 = alloca i64, align 8
  store ptr %0, ptr %22, align 8, !tbaa !5
  store i8 %1, ptr %23, align 1, !tbaa !9
  store i32 %2, ptr %24, align 4, !tbaa !10
  store ptr %3, ptr %25, align 8, !tbaa !5
  store i64 %4, ptr %26, align 8, !tbaa !12
  store i32 %5, ptr %27, align 4, !tbaa !10
  store ptr %6, ptr %28, align 8, !tbaa !5
  store ptr %7, ptr %29, align 8, !tbaa !5
  store ptr %8, ptr %30, align 8, !tbaa !5
  store i32 %9, ptr %31, align 4, !tbaa !10
  store i64 %10, ptr %32, align 8, !tbaa !12
  %51 = zext i1 %11 to i8
  store i8 %51, ptr %33, align 1, !tbaa !14
  %52 = zext i1 %12 to i8
  store i8 %52, ptr %34, align 1, !tbaa !14
  store i32 %13, ptr %35, align 4, !tbaa !10
  store i64 %14, ptr %36, align 8, !tbaa !12
  store ptr %15, ptr %37, align 8, !tbaa !5
  store ptr %16, ptr %38, align 8, !tbaa !5
  store ptr %17, ptr %39, align 8, !tbaa !5
  store ptr %18, ptr %40, align 8, !tbaa !5
  store i64 %19, ptr %41, align 8, !tbaa !12
  %53 = load ptr, ptr %25, align 8, !tbaa !5
  %54 = icmp ne ptr %53, null
  br i1 %54, label %59, label %55

55:                                               ; preds = %20
  %56 = load ptr, ptr %22, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.nem_transaction_ctx, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds [32 x i8], ptr %57, i64 0, i64 0
  store ptr %58, ptr %25, align 8, !tbaa !5
  br label %59

59:                                               ; preds = %55, %20
  call void @llvm.lifetime.start.p0(i64 1, ptr %42) #6
  %60 = load ptr, ptr %22, align 8, !tbaa !5
  %61 = load i8, ptr %23, align 1, !tbaa !9
  %62 = zext i8 %61 to i32
  %63 = shl i32 %62, 24
  %64 = or i32 %63, 1
  %65 = load i32, ptr %24, align 4, !tbaa !10
  %66 = load ptr, ptr %25, align 8, !tbaa !5
  %67 = load i64, ptr %26, align 8, !tbaa !12
  %68 = load i32, ptr %27, align 4, !tbaa !10
  %69 = call zeroext i1 @nem_transaction_write_common(ptr noundef %60, i32 noundef 16385, i32 noundef %64, i32 noundef %65, ptr noundef %66, i64 noundef %67, i32 noundef %68)
  %70 = zext i1 %69 to i8
  store i8 %70, ptr %42, align 1, !tbaa !14
  %71 = load i8, ptr %42, align 1, !tbaa !14, !range !16, !noundef !17
  %72 = trunc i8 %71 to i1
  br i1 %72, label %74, label %73

73:                                               ; preds = %59
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %284

74:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %44) #6
  %75 = load ptr, ptr %28, align 8, !tbaa !5
  %76 = call i64 @strlen(ptr noundef %75) #7
  store i64 %76, ptr %44, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %45) #6
  %77 = load ptr, ptr %29, align 8, !tbaa !5
  %78 = call i64 @strlen(ptr noundef %77) #7
  store i64 %78, ptr %45, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %46) #6
  %79 = load i64, ptr %44, align 8, !tbaa !12
  %80 = add i64 4, %79
  %81 = add i64 %80, 4
  %82 = load i64, ptr %45, align 8, !tbaa !12
  %83 = add i64 %81, %82
  store i64 %83, ptr %46, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 56, ptr %47) #6
  call void @llvm.memset.p0.i64(ptr align 8 %47, i8 0, i64 56, i1 false)
  %84 = load ptr, ptr %22, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %47, ptr align 8 %84, i64 56, i1 false)
  br label %85

85:                                               ; preds = %74
  %86 = load ptr, ptr %22, align 8, !tbaa !5
  %87 = call zeroext i1 @nem_write_u32(ptr noundef %86, i32 noundef 0)
  br i1 %87, label %89, label %88

88:                                               ; preds = %85
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

89:                                               ; preds = %85
  br label %90

90:                                               ; preds = %89
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91
  %93 = load ptr, ptr %22, align 8, !tbaa !5
  %94 = load ptr, ptr %25, align 8, !tbaa !5
  %95 = call zeroext i1 @nem_write_tagged(ptr noundef %93, ptr noundef %94, i32 noundef 32)
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

97:                                               ; preds = %92
  br label %98

98:                                               ; preds = %97
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  %101 = load ptr, ptr %22, align 8, !tbaa !5
  %102 = load i64, ptr %46, align 8, !tbaa !12
  %103 = trunc i64 %102 to i32
  %104 = call zeroext i1 @nem_write_u32(ptr noundef %101, i32 noundef %103)
  br i1 %104, label %106, label %105

105:                                              ; preds = %100
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

106:                                              ; preds = %100
  br label %107

107:                                              ; preds = %106
  br label %108

108:                                              ; preds = %107
  br label %109

109:                                              ; preds = %108
  %110 = load ptr, ptr %22, align 8, !tbaa !5
  %111 = load ptr, ptr %28, align 8, !tbaa !5
  %112 = load i64, ptr %44, align 8, !tbaa !12
  %113 = trunc i64 %112 to i32
  %114 = call zeroext i1 @nem_write_tagged(ptr noundef %110, ptr noundef %111, i32 noundef %113)
  br i1 %114, label %116, label %115

115:                                              ; preds = %109
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

116:                                              ; preds = %109
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117
  br label %119

119:                                              ; preds = %118
  %120 = load ptr, ptr %22, align 8, !tbaa !5
  %121 = load ptr, ptr %29, align 8, !tbaa !5
  %122 = load i64, ptr %45, align 8, !tbaa !12
  %123 = trunc i64 %122 to i32
  %124 = call zeroext i1 @nem_write_tagged(ptr noundef %120, ptr noundef %121, i32 noundef %123)
  br i1 %124, label %126, label %125

125:                                              ; preds = %119
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

126:                                              ; preds = %119
  br label %127

127:                                              ; preds = %126
  br label %128

128:                                              ; preds = %127
  br label %129

129:                                              ; preds = %128
  %130 = load ptr, ptr %22, align 8, !tbaa !5
  %131 = load ptr, ptr %30, align 8, !tbaa !5
  %132 = load ptr, ptr %30, align 8, !tbaa !5
  %133 = call i64 @strlen(ptr noundef %132) #7
  %134 = trunc i64 %133 to i32
  %135 = call zeroext i1 @nem_write_tagged(ptr noundef %130, ptr noundef %131, i32 noundef %134)
  br i1 %135, label %137, label %136

136:                                              ; preds = %129
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

137:                                              ; preds = %129
  br label %138

138:                                              ; preds = %137
  br label %139

139:                                              ; preds = %138
  br label %140

140:                                              ; preds = %139
  %141 = load ptr, ptr %22, align 8, !tbaa !5
  %142 = call zeroext i1 @nem_write_u32(ptr noundef %141, i32 noundef 4)
  br i1 %142, label %144, label %143

143:                                              ; preds = %140
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

144:                                              ; preds = %140
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145
  %147 = load ptr, ptr %22, align 8, !tbaa !5
  %148 = load i32, ptr %31, align 4, !tbaa !10
  %149 = zext i32 %148 to i64
  %150 = call zeroext i1 @nem_write_mosaic_u64(ptr noundef %147, ptr noundef @.str.3, i64 noundef %149)
  br i1 %150, label %152, label %151

151:                                              ; preds = %146
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

152:                                              ; preds = %146
  %153 = load ptr, ptr %22, align 8, !tbaa !5
  %154 = load i64, ptr %32, align 8, !tbaa !12
  %155 = call zeroext i1 @nem_write_mosaic_u64(ptr noundef %153, ptr noundef @.str.4, i64 noundef %154)
  br i1 %155, label %157, label %156

156:                                              ; preds = %152
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

157:                                              ; preds = %152
  %158 = load ptr, ptr %22, align 8, !tbaa !5
  %159 = load i8, ptr %33, align 1, !tbaa !14, !range !16, !noundef !17
  %160 = trunc i8 %159 to i1
  %161 = call zeroext i1 @nem_write_mosaic_bool(ptr noundef %158, ptr noundef @.str.5, i1 noundef zeroext %160)
  br i1 %161, label %163, label %162

162:                                              ; preds = %157
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

163:                                              ; preds = %157
  %164 = load ptr, ptr %22, align 8, !tbaa !5
  %165 = load i8, ptr %34, align 1, !tbaa !14, !range !16, !noundef !17
  %166 = trunc i8 %165 to i1
  %167 = call zeroext i1 @nem_write_mosaic_bool(ptr noundef %164, ptr noundef @.str.6, i1 noundef zeroext %166)
  br i1 %167, label %169, label %168

168:                                              ; preds = %163
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

169:                                              ; preds = %163
  %170 = load i32, ptr %35, align 4, !tbaa !10
  %171 = icmp ne i32 %170, 0
  br i1 %171, label %172, label %249

172:                                              ; preds = %169
  call void @llvm.lifetime.start.p0(i64 8, ptr %48) #6
  %173 = load ptr, ptr %38, align 8, !tbaa !5
  %174 = call i64 @strlen(ptr noundef %173) #7
  store i64 %174, ptr %48, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %49) #6
  %175 = load ptr, ptr %39, align 8, !tbaa !5
  %176 = call i64 @strlen(ptr noundef %175) #7
  store i64 %176, ptr %49, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %50) #6
  %177 = load i64, ptr %48, align 8, !tbaa !12
  %178 = add i64 4, %177
  %179 = add i64 %178, 4
  %180 = load i64, ptr %49, align 8, !tbaa !12
  %181 = add i64 %179, %180
  store i64 %181, ptr %50, align 8, !tbaa !12
  br label %182

182:                                              ; preds = %172
  %183 = load ptr, ptr %22, align 8, !tbaa !5
  %184 = load i64, ptr %50, align 8, !tbaa !12
  %185 = add i64 52, %184
  %186 = add i64 %185, 8
  %187 = trunc i64 %186 to i32
  %188 = call zeroext i1 @nem_write_u32(ptr noundef %183, i32 noundef %187)
  br i1 %188, label %190, label %189

189:                                              ; preds = %182
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %246

190:                                              ; preds = %182
  br label %191

191:                                              ; preds = %190
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192
  %194 = load ptr, ptr %22, align 8, !tbaa !5
  %195 = load i32, ptr %35, align 4, !tbaa !10
  %196 = call zeroext i1 @nem_write_u32(ptr noundef %194, i32 noundef %195)
  br i1 %196, label %198, label %197

197:                                              ; preds = %193
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %246

198:                                              ; preds = %193
  br label %199

199:                                              ; preds = %198
  br label %200

200:                                              ; preds = %199
  br label %201

201:                                              ; preds = %200
  %202 = load ptr, ptr %22, align 8, !tbaa !5
  %203 = load ptr, ptr %37, align 8, !tbaa !5
  %204 = call zeroext i1 @nem_write_tagged(ptr noundef %202, ptr noundef %203, i32 noundef 40)
  br i1 %204, label %206, label %205

205:                                              ; preds = %201
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %246

206:                                              ; preds = %201
  br label %207

207:                                              ; preds = %206
  br label %208

208:                                              ; preds = %207
  br label %209

209:                                              ; preds = %208
  %210 = load ptr, ptr %22, align 8, !tbaa !5
  %211 = load i64, ptr %50, align 8, !tbaa !12
  %212 = trunc i64 %211 to i32
  %213 = call zeroext i1 @nem_write_u32(ptr noundef %210, i32 noundef %212)
  br i1 %213, label %215, label %214

214:                                              ; preds = %209
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %246

215:                                              ; preds = %209
  br label %216

216:                                              ; preds = %215
  br label %217

217:                                              ; preds = %216
  br label %218

218:                                              ; preds = %217
  %219 = load ptr, ptr %22, align 8, !tbaa !5
  %220 = load ptr, ptr %38, align 8, !tbaa !5
  %221 = load i64, ptr %48, align 8, !tbaa !12
  %222 = trunc i64 %221 to i32
  %223 = call zeroext i1 @nem_write_tagged(ptr noundef %219, ptr noundef %220, i32 noundef %222)
  br i1 %223, label %225, label %224

224:                                              ; preds = %218
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %246

225:                                              ; preds = %218
  br label %226

226:                                              ; preds = %225
  br label %227

227:                                              ; preds = %226
  br label %228

228:                                              ; preds = %227
  %229 = load ptr, ptr %22, align 8, !tbaa !5
  %230 = load ptr, ptr %39, align 8, !tbaa !5
  %231 = load i64, ptr %49, align 8, !tbaa !12
  %232 = trunc i64 %231 to i32
  %233 = call zeroext i1 @nem_write_tagged(ptr noundef %229, ptr noundef %230, i32 noundef %232)
  br i1 %233, label %235, label %234

234:                                              ; preds = %228
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %246

235:                                              ; preds = %228
  br label %236

236:                                              ; preds = %235
  br label %237

237:                                              ; preds = %236
  br label %238

238:                                              ; preds = %237
  %239 = load ptr, ptr %22, align 8, !tbaa !5
  %240 = load i64, ptr %36, align 8, !tbaa !12
  %241 = call zeroext i1 @nem_write_u64(ptr noundef %239, i64 noundef %240)
  br i1 %241, label %243, label %242

242:                                              ; preds = %238
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %246

243:                                              ; preds = %238
  br label %244

244:                                              ; preds = %243
  br label %245

245:                                              ; preds = %244
  store i32 0, ptr %43, align 4
  br label %246

246:                                              ; preds = %245, %242, %234, %224, %214, %205, %197, %189
  call void @llvm.lifetime.end.p0(i64 8, ptr %50) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %49) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %48) #6
  %247 = load i32, ptr %43, align 4
  switch i32 %247, label %283 [
    i32 0, label %248
  ]

248:                                              ; preds = %246
  br label %257

249:                                              ; preds = %169
  br label %250

250:                                              ; preds = %249
  %251 = load ptr, ptr %22, align 8, !tbaa !5
  %252 = call zeroext i1 @nem_write_u32(ptr noundef %251, i32 noundef 0)
  br i1 %252, label %254, label %253

253:                                              ; preds = %250
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

254:                                              ; preds = %250
  br label %255

255:                                              ; preds = %254
  br label %256

256:                                              ; preds = %255
  br label %257

257:                                              ; preds = %256, %248
  %258 = load ptr, ptr %22, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct.nem_transaction_ctx, ptr %258, i32 0, i32 2
  %260 = load i64, ptr %259, align 8, !tbaa !18
  %261 = getelementptr inbounds %struct.nem_transaction_ctx, ptr %47, i32 0, i32 2
  %262 = load i64, ptr %261, align 8, !tbaa !18
  %263 = sub i64 %260, %262
  %264 = sub i64 %263, 4
  %265 = trunc i64 %264 to i32
  %266 = call zeroext i1 @nem_write_u32(ptr noundef %47, i32 noundef %265)
  br label %267

267:                                              ; preds = %257
  %268 = load ptr, ptr %22, align 8, !tbaa !5
  %269 = load ptr, ptr %40, align 8, !tbaa !5
  %270 = call zeroext i1 @nem_write_tagged(ptr noundef %268, ptr noundef %269, i32 noundef 40)
  br i1 %270, label %272, label %271

271:                                              ; preds = %267
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

272:                                              ; preds = %267
  br label %273

273:                                              ; preds = %272
  br label %274

274:                                              ; preds = %273
  br label %275

275:                                              ; preds = %274
  %276 = load ptr, ptr %22, align 8, !tbaa !5
  %277 = load i64, ptr %41, align 8, !tbaa !12
  %278 = call zeroext i1 @nem_write_u64(ptr noundef %276, i64 noundef %277)
  br i1 %278, label %280, label %279

279:                                              ; preds = %275
  store i1 false, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

280:                                              ; preds = %275
  br label %281

281:                                              ; preds = %280
  br label %282

282:                                              ; preds = %281
  store i1 true, ptr %21, align 1
  store i32 1, ptr %43, align 4
  br label %283

283:                                              ; preds = %282, %279, %271, %253, %246, %168, %162, %156, %151, %143, %136, %125, %115, %105, %96, %88
  call void @llvm.lifetime.end.p0(i64 56, ptr %47) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %46) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %45) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %44) #6
  br label %284

284:                                              ; preds = %283, %73
  call void @llvm.lifetime.end.p0(i64 1, ptr %42) #6
  %285 = load i1, ptr %21, align 1
  ret i1 %285
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @nem_write_mosaic_u64(ptr noundef, ptr noundef, i64 noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @nem_write_mosaic_bool(ptr noundef, ptr noundef, i1 noundef zeroext) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!19, !13, i64 40}
!19 = !{!"", !7, i64 0, !6, i64 32, !13, i64 40, !13, i64 48}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.nem_transaction_ctx = type { [32 x i8], ptr, i64, i64 }

@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @nem_transaction_write_common(ptr noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @nem_write_u32(ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @nem_write_tagged(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @nem_write_u64(ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @nem_transaction_create_mosaic_creation(ptr noundef %0, i8 noundef zeroext %1, i32 noundef %2, ptr noundef %3, i64 noundef %4, i32 noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, i32 noundef %9, i64 noundef %10, i1 noundef zeroext %11, i1 noundef zeroext %12, i32 noundef %13, i64 noundef %14, ptr noundef %15, ptr noundef %16, ptr noundef %17, ptr noundef %18, i64 noundef %19) local_unnamed_addr #3 {
  %21 = alloca %struct.nem_transaction_ctx, align 8
  %.not = icmp eq ptr %3, null
  %spec.select = select i1 %.not, ptr %0, ptr %3
  %22 = zext i8 %1 to i32
  %23 = shl nuw i32 %22, 24
  %24 = or disjoint i32 %23, 1
  %25 = tail call zeroext i1 @nem_transaction_write_common(ptr noundef %0, i32 noundef 16385, i32 noundef %24, i32 noundef %2, ptr noundef %spec.select, i64 noundef %4, i32 noundef %5)
  br i1 %25, label %26, label %95

26:                                               ; preds = %20
  %27 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %6) #5
  %28 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %7) #5
  %29 = add i64 %27, 8
  %30 = add i64 %29, %28
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %21) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %21, ptr noundef nonnull align 8 dereferenceable(56) %0, i64 56, i1 false)
  %31 = tail call zeroext i1 @nem_write_u32(ptr noundef %0, i32 noundef 0)
  br i1 %31, label %32, label %.critedge

32:                                               ; preds = %26
  %33 = tail call zeroext i1 @nem_write_tagged(ptr noundef nonnull %0, ptr noundef %spec.select, i32 noundef 32)
  br i1 %33, label %34, label %.critedge

34:                                               ; preds = %32
  %35 = trunc i64 %30 to i32
  %36 = tail call zeroext i1 @nem_write_u32(ptr noundef nonnull %0, i32 noundef %35)
  br i1 %36, label %37, label %.critedge

37:                                               ; preds = %34
  %38 = trunc i64 %27 to i32
  %39 = tail call zeroext i1 @nem_write_tagged(ptr noundef nonnull %0, ptr noundef %6, i32 noundef %38)
  br i1 %39, label %40, label %.critedge

40:                                               ; preds = %37
  %41 = trunc i64 %28 to i32
  %42 = tail call zeroext i1 @nem_write_tagged(ptr noundef nonnull %0, ptr noundef %7, i32 noundef %41)
  br i1 %42, label %43, label %.critedge

43:                                               ; preds = %40
  %44 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %8) #5
  %45 = trunc i64 %44 to i32
  %46 = tail call zeroext i1 @nem_write_tagged(ptr noundef nonnull %0, ptr noundef %8, i32 noundef %45)
  br i1 %46, label %47, label %.critedge

47:                                               ; preds = %43
  %48 = tail call zeroext i1 @nem_write_u32(ptr noundef nonnull %0, i32 noundef 4)
  br i1 %48, label %49, label %.critedge

49:                                               ; preds = %47
  %50 = zext i32 %9 to i64
  %51 = tail call zeroext i1 @nem_write_mosaic_u64(ptr noundef nonnull %0, ptr noundef nonnull @.str.3, i64 noundef %50)
  br i1 %51, label %52, label %.critedge

52:                                               ; preds = %49
  %53 = tail call zeroext i1 @nem_write_mosaic_u64(ptr noundef nonnull %0, ptr noundef nonnull @.str.4, i64 noundef %10)
  br i1 %53, label %54, label %.critedge

54:                                               ; preds = %52
  %55 = tail call zeroext i1 @nem_write_mosaic_bool(ptr noundef nonnull %0, ptr noundef nonnull @.str.5, i1 noundef zeroext %11)
  br i1 %55, label %56, label %.critedge

56:                                               ; preds = %54
  %57 = tail call zeroext i1 @nem_write_mosaic_bool(ptr noundef nonnull %0, ptr noundef nonnull @.str.6, i1 noundef zeroext %12)
  br i1 %57, label %58, label %.critedge

58:                                               ; preds = %56
  %.not68 = icmp eq i32 %13, 0
  br i1 %.not68, label %81, label %59

59:                                               ; preds = %58
  %60 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %16) #5
  %61 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %17) #5
  %62 = add i64 %60, 8
  %63 = add i64 %62, %61
  %64 = trunc i64 %63 to i32
  %65 = add i32 %64, 60
  %66 = tail call zeroext i1 @nem_write_u32(ptr noundef nonnull %0, i32 noundef %65)
  br i1 %66, label %67, label %.critedge

67:                                               ; preds = %59
  %68 = tail call zeroext i1 @nem_write_u32(ptr noundef nonnull %0, i32 noundef %13)
  br i1 %68, label %69, label %.critedge

69:                                               ; preds = %67
  %70 = tail call zeroext i1 @nem_write_tagged(ptr noundef nonnull %0, ptr noundef %15, i32 noundef 40)
  br i1 %70, label %71, label %.critedge

71:                                               ; preds = %69
  %72 = tail call zeroext i1 @nem_write_u32(ptr noundef nonnull %0, i32 noundef %64)
  br i1 %72, label %73, label %.critedge

73:                                               ; preds = %71
  %74 = trunc i64 %60 to i32
  %75 = tail call zeroext i1 @nem_write_tagged(ptr noundef nonnull %0, ptr noundef %16, i32 noundef %74)
  br i1 %75, label %76, label %.critedge

76:                                               ; preds = %73
  %77 = trunc i64 %61 to i32
  %78 = tail call zeroext i1 @nem_write_tagged(ptr noundef nonnull %0, ptr noundef %17, i32 noundef %77)
  br i1 %78, label %79, label %.critedge

79:                                               ; preds = %76
  %80 = tail call zeroext i1 @nem_write_u64(ptr noundef nonnull %0, i64 noundef %14)
  br i1 %80, label %83, label %.critedge

81:                                               ; preds = %58
  %82 = tail call zeroext i1 @nem_write_u32(ptr noundef nonnull %0, i32 noundef 0)
  br i1 %82, label %83, label %.critedge

83:                                               ; preds = %81, %79
  %84 = getelementptr inbounds i8, ptr %0, i64 40
  %85 = load i64, ptr %84, align 8, !tbaa !5
  %86 = getelementptr inbounds i8, ptr %21, i64 40
  %87 = load i64, ptr %86, align 8, !tbaa !5
  %88 = sub i64 %85, %87
  %89 = trunc i64 %88 to i32
  %90 = add i32 %89, -4
  %91 = call zeroext i1 @nem_write_u32(ptr noundef nonnull %21, i32 noundef %90)
  %92 = call zeroext i1 @nem_write_tagged(ptr noundef nonnull %0, ptr noundef %18, i32 noundef 40)
  br i1 %92, label %93, label %.critedge

93:                                               ; preds = %83
  %94 = call zeroext i1 @nem_write_u64(ptr noundef nonnull %0, i64 noundef %19)
  br label %.critedge

.critedge:                                        ; preds = %59, %67, %69, %71, %73, %76, %93, %83, %81, %56, %54, %52, %49, %47, %43, %40, %37, %34, %32, %26, %79
  %.1 = phi i1 [ false, %79 ], [ false, %26 ], [ false, %32 ], [ false, %34 ], [ false, %37 ], [ false, %40 ], [ false, %43 ], [ false, %47 ], [ false, %49 ], [ false, %52 ], [ false, %54 ], [ false, %56 ], [ false, %81 ], [ false, %83 ], [ %94, %93 ], [ false, %76 ], [ false, %73 ], [ false, %71 ], [ false, %69 ], [ false, %67 ], [ false, %59 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %21) #6
  br label %95

95:                                               ; preds = %20, %.critedge
  %.2 = phi i1 [ %.1, %.critedge ], [ false, %20 ]
  ret i1 %.2
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @nem_write_mosaic_u64(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @nem_write_mosaic_bool(ptr noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind willreturn memory(read) }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 40}
!6 = !{!"", !7, i64 0, !9, i64 32, !10, i64 40, !10, i64 48}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"long", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass